OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_BROWSER_H_ | 5 #ifndef CHROME_BROWSER_BROWSER_H_ |
6 #define CHROME_BROWSER_BROWSER_H_ | 6 #define CHROME_BROWSER_BROWSER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // what the user has done. | 84 // what the user has done. |
85 MAXIMIZED_STATE_DEFAULT, | 85 MAXIMIZED_STATE_DEFAULT, |
86 | 86 |
87 // Maximized state is explicitly maximized. | 87 // Maximized state is explicitly maximized. |
88 MAXIMIZED_STATE_MAXIMIZED, | 88 MAXIMIZED_STATE_MAXIMIZED, |
89 | 89 |
90 // Maximized state is explicitly not maximized (normal). | 90 // Maximized state is explicitly not maximized (normal). |
91 MAXIMIZED_STATE_UNMAXIMIZED | 91 MAXIMIZED_STATE_UNMAXIMIZED |
92 }; | 92 }; |
93 | 93 |
| 94 // Constants passed to AddTabWithURL. |
| 95 enum AddTabTypes { |
| 96 // The tab should be selected. |
| 97 ADD_SELECTED = 1 << 0, |
| 98 |
| 99 // The tab should be pinned. |
| 100 ADD_PINNED = 1 << 1, |
| 101 |
| 102 // See TabStripModel::AddTabContents for details. |
| 103 ADD_FORCE_INDEX = 1 << 2, |
| 104 }; |
| 105 |
94 // Constructors, Creation, Showing ////////////////////////////////////////// | 106 // Constructors, Creation, Showing ////////////////////////////////////////// |
95 | 107 |
96 // Creates a new browser of the given |type| and for the given |profile|. The | 108 // Creates a new browser of the given |type| and for the given |profile|. The |
97 // Browser has a NULL window after its construction, CreateBrowserWindow must | 109 // Browser has a NULL window after its construction, CreateBrowserWindow must |
98 // be called after configuration for window() to be valid. | 110 // be called after configuration for window() to be valid. |
99 Browser(Type type, Profile* profile); | 111 Browser(Type type, Profile* profile); |
100 virtual ~Browser(); | 112 virtual ~Browser(); |
101 | 113 |
102 // Creates a normal tabbed browser with the specified profile. The Browser's | 114 // Creates a normal tabbed browser with the specified profile. The Browser's |
103 // window is created by this function call. | 115 // window is created by this function call. |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 void CloseAllTabs() { | 288 void CloseAllTabs() { |
277 tabstrip_model_.CloseAllTabs(); | 289 tabstrip_model_.CloseAllTabs(); |
278 } | 290 } |
279 | 291 |
280 // Tab adding/showing functions ///////////////////////////////////////////// | 292 // Tab adding/showing functions ///////////////////////////////////////////// |
281 | 293 |
282 // Add a new tab with the specified URL. If instance is not null, its process | 294 // Add a new tab with the specified URL. If instance is not null, its process |
283 // will be used to render the tab. |force_index| is passed through to | 295 // will be used to render the tab. |force_index| is passed through to |
284 // TabStripModel::AddTabContents and its meaning is documented with its | 296 // TabStripModel::AddTabContents and its meaning is documented with its |
285 // declaration. | 297 // declaration. |
| 298 // TODO(sky): nuke this and convert callers to new AddTablWithURL variant. |
286 TabContents* AddTabWithURL(const GURL& url, | 299 TabContents* AddTabWithURL(const GURL& url, |
287 const GURL& referrer, | 300 const GURL& referrer, |
288 PageTransition::Type transition, | 301 PageTransition::Type transition, |
289 bool foreground, | 302 bool foreground, |
290 int index, | 303 int index, |
291 bool force_index, | 304 bool force_index, |
292 SiteInstance* instance); | 305 SiteInstance* instance); |
293 | 306 |
| 307 // Adds a new tab at the specified index. |add_types| is a bitmask of the |
| 308 // values defined by AddTabTypes; see AddTabTypes for details. If |instance| |
| 309 // is not null, its process will be used to render the tab. If |
| 310 // |app_extension_id| is non-empty the new tab is an app tab. |
| 311 TabContents* AddTabWithURL(const GURL& url, |
| 312 const GURL& referrer, |
| 313 PageTransition::Type transition, |
| 314 int index, |
| 315 int add_types, |
| 316 SiteInstance* instance, |
| 317 const std::string& app_extension_id); |
| 318 |
294 // Add a new tab, given a TabContents. A TabContents appropriate to | 319 // Add a new tab, given a TabContents. A TabContents appropriate to |
295 // display the last committed entry is created and returned. | 320 // display the last committed entry is created and returned. |
296 TabContents* AddTab(TabContents* tab_contents, PageTransition::Type type); | 321 TabContents* AddTab(TabContents* tab_contents, PageTransition::Type type); |
297 | 322 |
298 // Add a tab with its session history restored from the SessionRestore | 323 // Add a tab with its session history restored from the SessionRestore |
299 // system. If select is true, the tab is selected. |tab_index| gives the index | 324 // system. If select is true, the tab is selected. |tab_index| gives the index |
300 // to insert the tab at. |selected_navigation| is the index of the | 325 // to insert the tab at. |selected_navigation| is the index of the |
301 // TabNavigation in |navigations| to select. If |app_extension_id| is | 326 // TabNavigation in |navigations| to select. If |app_extension_id| is |
302 // non-empty the tab is an app tab and |app_extension_id| is the id of the | 327 // non-empty the tab is an app tab and |app_extension_id| is the id of the |
303 // extension. If |pin| is true and |tab_index|/ is the last pinned tab, then | 328 // extension. If |pin| is true and |tab_index|/ is the last pinned tab, then |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 // TODO(beng): figure out if we need this now that the frame itself closes | 807 // TODO(beng): figure out if we need this now that the frame itself closes |
783 // after a return to the message loop. | 808 // after a return to the message loop. |
784 void CloseFrame(); | 809 void CloseFrame(); |
785 | 810 |
786 void TabDetachedAtImpl(TabContents* contents, int index, DetachType type); | 811 void TabDetachedAtImpl(TabContents* contents, int index, DetachType type); |
787 | 812 |
788 // Create a preference dictionary for the provided application name. This is | 813 // Create a preference dictionary for the provided application name. This is |
789 // done only once per application name / per session. | 814 // done only once per application name / per session. |
790 static void RegisterAppPrefs(const std::wstring& app_name); | 815 static void RegisterAppPrefs(const std::wstring& app_name); |
791 | 816 |
792 // If |app_extension_id| is not empty this sets the application extension of | |
793 // |contents| to the extension whose id is |app_extension_id|. | |
794 void SetAppExtensionById(TabContents* contents, | |
795 const std::string& app_extension_id); | |
796 | |
797 // Shared code between Reload() and ReloadAll(). | 817 // Shared code between Reload() and ReloadAll(). |
798 void ReloadInternal(bool ignore_cache); | 818 void ReloadInternal(bool ignore_cache); |
799 | 819 |
800 // Data members ///////////////////////////////////////////////////////////// | 820 // Data members ///////////////////////////////////////////////////////////// |
801 | 821 |
802 NotificationRegistrar registrar_; | 822 NotificationRegistrar registrar_; |
803 | 823 |
804 // This Browser's type. | 824 // This Browser's type. |
805 const Type type_; | 825 const Type type_; |
806 | 826 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 }; | 932 }; |
913 | 933 |
914 // Which deferred action to perform when OnDidGetApplicationInfo is notified | 934 // Which deferred action to perform when OnDidGetApplicationInfo is notified |
915 // from a TabContents. Currently, only one pending action is allowed. | 935 // from a TabContents. Currently, only one pending action is allowed. |
916 WebAppAction pending_web_app_action_; | 936 WebAppAction pending_web_app_action_; |
917 | 937 |
918 DISALLOW_COPY_AND_ASSIGN(Browser); | 938 DISALLOW_COPY_AND_ASSIGN(Browser); |
919 }; | 939 }; |
920 | 940 |
921 #endif // CHROME_BROWSER_BROWSER_H_ | 941 #endif // CHROME_BROWSER_BROWSER_H_ |
OLD | NEW |