Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_BROWSER_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_H_ |
| 6 #define CHROME_BROWSER_UI_BROWSER_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 public content::PageNavigator, | 104 public content::PageNavigator, |
| 105 public content::NotificationObserver, | 105 public content::NotificationObserver, |
| 106 public ui::SelectFileDialog::Listener { | 106 public ui::SelectFileDialog::Listener { |
| 107 public: | 107 public: |
| 108 // SessionService::WindowType mirrors these values. If you add to this | 108 // SessionService::WindowType mirrors these values. If you add to this |
| 109 // enum, look at SessionService::WindowType to see if it needs to be | 109 // enum, look at SessionService::WindowType to see if it needs to be |
| 110 // updated. | 110 // updated. |
| 111 enum Type { | 111 enum Type { |
| 112 // If you add a new type, consider updating the test | 112 // If you add a new type, consider updating the test |
| 113 // BrowserTest.StartMaximized. | 113 // BrowserTest.StartMaximized. |
| 114 TYPE_TABBED = 1, | 114 TYPE_TABBED = 1, // A tabbed browser |
| 115 TYPE_POPUP = 2 | 115 TYPE_POPUP = 2, // A popup window opened by a browser page or an app |
| 116 }; | 116 TYPE_HOSTED_POPUP = 3 // A popup window for a hosted app or system page |
|
Ben Goodger (Google)
2014/03/19 17:30:19
I would be inclined to come up with a different na
stevenjb
2014/04/04 00:04:10
'TRUSTED' was actually my first thought also, alth
| |
| 117 | |
| 118 // Distinguishes between browsers that host an app (opened from | |
| 119 // ApplicationLauncher::OpenApplication), and child browsers created by an app | |
| 120 // from Browser::CreateForApp (e.g. by windows.open or the extension API). | |
| 121 enum AppType { | |
| 122 APP_TYPE_HOST = 1, | |
| 123 APP_TYPE_CHILD = 2 | |
| 124 }; | 117 }; |
| 125 | 118 |
| 126 // Possible elements of the Browser window. | 119 // Possible elements of the Browser window. |
| 127 enum WindowFeature { | 120 enum WindowFeature { |
| 128 FEATURE_NONE = 0, | 121 FEATURE_NONE = 0, |
| 129 FEATURE_TITLEBAR = 1, | 122 FEATURE_TITLEBAR = 1, |
| 130 FEATURE_TABSTRIP = 2, | 123 FEATURE_TABSTRIP = 2, |
| 131 FEATURE_TOOLBAR = 4, | 124 FEATURE_TOOLBAR = 4, |
| 132 FEATURE_LOCATIONBAR = 8, | 125 FEATURE_LOCATIONBAR = 8, |
| 133 FEATURE_BOOKMARKBAR = 16, | 126 FEATURE_BOOKMARKBAR = 16, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 | 161 |
| 169 // The browser type. | 162 // The browser type. |
| 170 Type type; | 163 Type type; |
| 171 | 164 |
| 172 // The associated profile. | 165 // The associated profile. |
| 173 Profile* profile; | 166 Profile* profile; |
| 174 | 167 |
| 175 // The host desktop the browser is created on. | 168 // The host desktop the browser is created on. |
| 176 chrome::HostDesktopType host_desktop_type; | 169 chrome::HostDesktopType host_desktop_type; |
| 177 | 170 |
| 178 // The application name that is also the name of the window to the shell. | |
| 179 // This name should be set when: | |
| 180 // 1) we launch an application via an application shortcut or extension API. | |
| 181 // 2) we launch an undocked devtool window. | |
| 182 std::string app_name; | |
| 183 | |
| 184 // Type of app (host or child). See description of AppType. | |
| 185 AppType app_type; | |
| 186 | |
| 187 // The bounds of the window to open. | 171 // The bounds of the window to open. |
| 188 gfx::Rect initial_bounds; | 172 gfx::Rect initial_bounds; |
| 189 | 173 |
| 190 ui::WindowShowState initial_show_state; | 174 ui::WindowShowState initial_show_state; |
| 191 | 175 |
| 192 bool is_session_restore; | 176 bool is_session_restore; |
| 193 | 177 |
| 194 // Supply a custom BrowserWindow implementation, to be used instead of the | 178 // Supply a custom BrowserWindow implementation, to be used instead of the |
| 195 // default. Intended for testing. | 179 // default. Intended for testing. |
| 196 BrowserWindow* window; | 180 BrowserWindow* window; |
| 181 | |
| 182 private: | |
| 183 friend class Browser; | |
| 184 | |
| 185 // The application name that is also the name of the window to the shell. | |
| 186 // Do not set this value directly, use CreateForApp. | |
| 187 // This name will be set for: | |
| 188 // 1) v1 applications launched via an application shortcut or extension API. | |
| 189 // 2) undocked devtool windows. | |
| 190 // 3) popup windows spawned from v1 applications. | |
| 191 std::string app_name; | |
| 197 }; | 192 }; |
| 198 | 193 |
| 199 // Constructors, Creation, Showing ////////////////////////////////////////// | 194 // Constructors, Creation, Showing ////////////////////////////////////////// |
| 200 | 195 |
| 201 explicit Browser(const CreateParams& params); | 196 explicit Browser(const CreateParams& params); |
| 202 virtual ~Browser(); | 197 virtual ~Browser(); |
| 203 | 198 |
| 204 // Set overrides for the initial window bounds and maximized state. | 199 // Set overrides for the initial window bounds and maximized state. |
| 205 void set_override_bounds(const gfx::Rect& bounds) { | 200 void set_override_bounds(const gfx::Rect& bounds) { |
| 206 override_bounds_ = bounds; | 201 override_bounds_ = bounds; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 223 return is_session_restore_; | 218 return is_session_restore_; |
| 224 } | 219 } |
| 225 chrome::HostDesktopType host_desktop_type() const { | 220 chrome::HostDesktopType host_desktop_type() const { |
| 226 return host_desktop_type_; | 221 return host_desktop_type_; |
| 227 } | 222 } |
| 228 | 223 |
| 229 // Accessors //////////////////////////////////////////////////////////////// | 224 // Accessors //////////////////////////////////////////////////////////////// |
| 230 | 225 |
| 231 Type type() const { return type_; } | 226 Type type() const { return type_; } |
| 232 const std::string& app_name() const { return app_name_; } | 227 const std::string& app_name() const { return app_name_; } |
| 233 AppType app_type() const { return app_type_; } | |
| 234 Profile* profile() const { return profile_; } | 228 Profile* profile() const { return profile_; } |
| 235 gfx::Rect override_bounds() const { return override_bounds_; } | 229 gfx::Rect override_bounds() const { return override_bounds_; } |
| 236 | 230 |
| 237 // |window()| will return NULL if called before |CreateBrowserWindow()| | 231 // |window()| will return NULL if called before |CreateBrowserWindow()| |
| 238 // is done. | 232 // is done. |
| 239 BrowserWindow* window() const { return window_; } | 233 BrowserWindow* window() const { return window_; } |
| 240 ToolbarModel* toolbar_model() { return toolbar_model_.get(); } | 234 ToolbarModel* toolbar_model() { return toolbar_model_.get(); } |
| 241 const ToolbarModel* toolbar_model() const { return toolbar_model_.get(); } | 235 const ToolbarModel* toolbar_model() const { return toolbar_model_.get(); } |
| 242 #if defined(UNIT_TEST) | 236 #if defined(UNIT_TEST) |
| 243 void swap_toolbar_models(scoped_ptr<ToolbarModel>* toolbar_model) { | 237 void swap_toolbar_models(scoped_ptr<ToolbarModel>* toolbar_model) { |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 449 virtual void HideValidationMessage( | 443 virtual void HideValidationMessage( |
| 450 content::WebContents* web_contents) OVERRIDE; | 444 content::WebContents* web_contents) OVERRIDE; |
| 451 virtual void MoveValidationMessage( | 445 virtual void MoveValidationMessage( |
| 452 content::WebContents* web_contents, | 446 content::WebContents* web_contents, |
| 453 const gfx::Rect& anchor_in_root_view) OVERRIDE; | 447 const gfx::Rect& anchor_in_root_view) OVERRIDE; |
| 454 virtual bool PreHandleGestureEvent( | 448 virtual bool PreHandleGestureEvent( |
| 455 content::WebContents* source, | 449 content::WebContents* source, |
| 456 const blink::WebGestureEvent& event) OVERRIDE; | 450 const blink::WebGestureEvent& event) OVERRIDE; |
| 457 | 451 |
| 458 bool is_type_tabbed() const { return type_ == TYPE_TABBED; } | 452 bool is_type_tabbed() const { return type_ == TYPE_TABBED; } |
| 459 bool is_type_popup() const { return type_ == TYPE_POPUP; } | 453 bool is_type_popup() const { |
| 454 return type_ == TYPE_POPUP || type_ == TYPE_HOSTED_POPUP; | |
| 455 } | |
| 460 | 456 |
| 461 bool is_app() const; | 457 bool is_app() const; |
| 462 bool is_devtools() const; | 458 bool is_devtools() const; |
| 463 | 459 |
| 464 // True when the mouse cursor is locked. | 460 // True when the mouse cursor is locked. |
| 465 bool IsMouseLocked() const; | 461 bool IsMouseLocked() const; |
| 466 | 462 |
| 467 // Called each time the browser window is shown. | 463 // Called each time the browser window is shown. |
| 468 void OnWindowDidShow(); | 464 void OnWindowDidShow(); |
| 469 | 465 |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 817 | 813 |
| 818 scoped_ptr<TabStripModelDelegate> tab_strip_model_delegate_; | 814 scoped_ptr<TabStripModelDelegate> tab_strip_model_delegate_; |
| 819 scoped_ptr<TabStripModel> tab_strip_model_; | 815 scoped_ptr<TabStripModel> tab_strip_model_; |
| 820 | 816 |
| 821 // The application name that is also the name of the window to the shell. | 817 // The application name that is also the name of the window to the shell. |
| 822 // This name should be set when: | 818 // This name should be set when: |
| 823 // 1) we launch an application via an application shortcut or extension API. | 819 // 1) we launch an application via an application shortcut or extension API. |
| 824 // 2) we launch an undocked devtool window. | 820 // 2) we launch an undocked devtool window. |
| 825 std::string app_name_; | 821 std::string app_name_; |
| 826 | 822 |
| 827 // Type of app (host or child). See description of AppType. | |
| 828 AppType app_type_; | |
| 829 | |
| 830 // Unique identifier of this browser for session restore. This id is only | 823 // Unique identifier of this browser for session restore. This id is only |
| 831 // unique within the current session, and is not guaranteed to be unique | 824 // unique within the current session, and is not guaranteed to be unique |
| 832 // across sessions. | 825 // across sessions. |
| 833 const SessionID session_id_; | 826 const SessionID session_id_; |
| 834 | 827 |
| 835 // The model for the toolbar view. | 828 // The model for the toolbar view. |
| 836 scoped_ptr<ToolbarModel> toolbar_model_; | 829 scoped_ptr<ToolbarModel> toolbar_model_; |
| 837 | 830 |
| 838 // The model for the "active" search state. There are per-tab search models | 831 // The model for the "active" search state. There are per-tab search models |
| 839 // as well. When a tab is active its model is kept in sync with this one. | 832 // as well. When a tab is active its model is kept in sync with this one. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 931 base::WeakPtrFactory<Browser> weak_factory_; | 924 base::WeakPtrFactory<Browser> weak_factory_; |
| 932 | 925 |
| 933 scoped_ptr<BrowserContentTranslateDriverObserver> translate_driver_observer_; | 926 scoped_ptr<BrowserContentTranslateDriverObserver> translate_driver_observer_; |
| 934 | 927 |
| 935 scoped_ptr<chrome::ValidationMessageBubble> validation_message_bubble_; | 928 scoped_ptr<chrome::ValidationMessageBubble> validation_message_bubble_; |
| 936 | 929 |
| 937 DISALLOW_COPY_AND_ASSIGN(Browser); | 930 DISALLOW_COPY_AND_ASSIGN(Browser); |
| 938 }; | 931 }; |
| 939 | 932 |
| 940 #endif // CHROME_BROWSER_UI_BROWSER_H_ | 933 #endif // CHROME_BROWSER_UI_BROWSER_H_ |
| OLD | NEW |