Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: chrome/browser/ui/browser.h

Issue 187443008: Elim Browser::AppType (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and add non trusted type test Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 public content::PageNavigator, 103 public content::PageNavigator,
104 public content::NotificationObserver, 104 public content::NotificationObserver,
105 public ui::SelectFileDialog::Listener { 105 public ui::SelectFileDialog::Listener {
106 public: 106 public:
107 // SessionService::WindowType mirrors these values. If you add to this 107 // SessionService::WindowType mirrors these values. If you add to this
108 // enum, look at SessionService::WindowType to see if it needs to be 108 // enum, look at SessionService::WindowType to see if it needs to be
109 // updated. 109 // updated.
110 enum Type { 110 enum Type {
111 // If you add a new type, consider updating the test 111 // If you add a new type, consider updating the test
112 // BrowserTest.StartMaximized. 112 // BrowserTest.StartMaximized.
113 TYPE_TABBED = 1, 113 TYPE_TABBED = 1, // A tabbed browser
114 TYPE_POPUP = 2 114 TYPE_POPUP = 2, // A popup window opened by a browser page or an app
115 }; 115 TYPE_TRUSTED_POPUP = 3 // A primary hosted app window or system popup
116
117 // Distinguishes between browsers that host an app (opened from
118 // ApplicationLauncher::OpenApplication), and child browsers created by an app
119 // from Browser::CreateForApp (e.g. by windows.open or the extension API).
120 enum AppType {
121 APP_TYPE_HOST = 1,
122 APP_TYPE_CHILD = 2
123 }; 116 };
124 117
125 // Possible elements of the Browser window. 118 // Possible elements of the Browser window.
126 enum WindowFeature { 119 enum WindowFeature {
127 FEATURE_NONE = 0, 120 FEATURE_NONE = 0,
128 FEATURE_TITLEBAR = 1, 121 FEATURE_TITLEBAR = 1,
129 FEATURE_TABSTRIP = 2, 122 FEATURE_TABSTRIP = 2,
130 FEATURE_TOOLBAR = 4, 123 FEATURE_TOOLBAR = 4,
131 FEATURE_LOCATIONBAR = 8, 124 FEATURE_LOCATIONBAR = 8,
132 FEATURE_BOOKMARKBAR = 16, 125 FEATURE_BOOKMARKBAR = 16,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 160
168 // The browser type. 161 // The browser type.
169 Type type; 162 Type type;
170 163
171 // The associated profile. 164 // The associated profile.
172 Profile* profile; 165 Profile* profile;
173 166
174 // The host desktop the browser is created on. 167 // The host desktop the browser is created on.
175 chrome::HostDesktopType host_desktop_type; 168 chrome::HostDesktopType host_desktop_type;
176 169
177 // The application name that is also the name of the window to the shell.
178 // This name should be set when:
179 // 1) we launch an application via an application shortcut or extension API.
180 // 2) we launch an undocked devtool window.
181 std::string app_name;
182
183 // Type of app (host or child). See description of AppType.
184 AppType app_type;
185
186 // The bounds of the window to open. 170 // The bounds of the window to open.
187 gfx::Rect initial_bounds; 171 gfx::Rect initial_bounds;
188 172
189 ui::WindowShowState initial_show_state; 173 ui::WindowShowState initial_show_state;
190 174
191 bool is_session_restore; 175 bool is_session_restore;
192 176
193 // Supply a custom BrowserWindow implementation, to be used instead of the 177 // Supply a custom BrowserWindow implementation, to be used instead of the
194 // default. Intended for testing. 178 // default. Intended for testing.
195 BrowserWindow* window; 179 BrowserWindow* window;
180
181 private:
182 friend class Browser;
183
184 // The application name that is also the name of the window to the shell.
185 // Do not set this value directly, use CreateForApp.
186 // This name will be set for:
187 // 1) v1 applications launched via an application shortcut or extension API.
188 // 2) undocked devtool windows.
189 // 3) popup windows spawned from v1 applications.
190 std::string app_name;
196 }; 191 };
197 192
198 // Constructors, Creation, Showing ////////////////////////////////////////// 193 // Constructors, Creation, Showing //////////////////////////////////////////
199 194
200 explicit Browser(const CreateParams& params); 195 explicit Browser(const CreateParams& params);
201 virtual ~Browser(); 196 virtual ~Browser();
202 197
203 // Set overrides for the initial window bounds and maximized state. 198 // Set overrides for the initial window bounds and maximized state.
204 void set_override_bounds(const gfx::Rect& bounds) { 199 void set_override_bounds(const gfx::Rect& bounds) {
205 override_bounds_ = bounds; 200 override_bounds_ = bounds;
(...skipping 16 matching lines...) Expand all
222 return is_session_restore_; 217 return is_session_restore_;
223 } 218 }
224 chrome::HostDesktopType host_desktop_type() const { 219 chrome::HostDesktopType host_desktop_type() const {
225 return host_desktop_type_; 220 return host_desktop_type_;
226 } 221 }
227 222
228 // Accessors //////////////////////////////////////////////////////////////// 223 // Accessors ////////////////////////////////////////////////////////////////
229 224
230 Type type() const { return type_; } 225 Type type() const { return type_; }
231 const std::string& app_name() const { return app_name_; } 226 const std::string& app_name() const { return app_name_; }
232 AppType app_type() const { return app_type_; }
233 Profile* profile() const { return profile_; } 227 Profile* profile() const { return profile_; }
234 gfx::Rect override_bounds() const { return override_bounds_; } 228 gfx::Rect override_bounds() const { return override_bounds_; }
235 229
236 // |window()| will return NULL if called before |CreateBrowserWindow()| 230 // |window()| will return NULL if called before |CreateBrowserWindow()|
237 // is done. 231 // is done.
238 BrowserWindow* window() const { return window_; } 232 BrowserWindow* window() const { return window_; }
239 ToolbarModel* toolbar_model() { return toolbar_model_.get(); } 233 ToolbarModel* toolbar_model() { return toolbar_model_.get(); }
240 const ToolbarModel* toolbar_model() const { return toolbar_model_.get(); } 234 const ToolbarModel* toolbar_model() const { return toolbar_model_.get(); }
241 #if defined(UNIT_TEST) 235 #if defined(UNIT_TEST)
242 void swap_toolbar_models(scoped_ptr<ToolbarModel>* toolbar_model) { 236 void swap_toolbar_models(scoped_ptr<ToolbarModel>* toolbar_model) {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 virtual void HideValidationMessage( 442 virtual void HideValidationMessage(
449 content::WebContents* web_contents) OVERRIDE; 443 content::WebContents* web_contents) OVERRIDE;
450 virtual void MoveValidationMessage( 444 virtual void MoveValidationMessage(
451 content::WebContents* web_contents, 445 content::WebContents* web_contents,
452 const gfx::Rect& anchor_in_root_view) OVERRIDE; 446 const gfx::Rect& anchor_in_root_view) OVERRIDE;
453 virtual bool PreHandleGestureEvent( 447 virtual bool PreHandleGestureEvent(
454 content::WebContents* source, 448 content::WebContents* source,
455 const blink::WebGestureEvent& event) OVERRIDE; 449 const blink::WebGestureEvent& event) OVERRIDE;
456 450
457 bool is_type_tabbed() const { return type_ == TYPE_TABBED; } 451 bool is_type_tabbed() const { return type_ == TYPE_TABBED; }
458 bool is_type_popup() const { return type_ == TYPE_POPUP; } 452 bool is_type_popup() const {
453 return type_ == TYPE_POPUP || type_ == TYPE_TRUSTED_POPUP;
454 }
459 455
460 bool is_app() const; 456 bool is_app() const;
461 bool is_devtools() const; 457 bool is_devtools() const;
462 458
463 // True when the mouse cursor is locked. 459 // True when the mouse cursor is locked.
464 bool IsMouseLocked() const; 460 bool IsMouseLocked() const;
465 461
466 // Called each time the browser window is shown. 462 // Called each time the browser window is shown.
467 void OnWindowDidShow(); 463 void OnWindowDidShow();
468 464
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 810
815 scoped_ptr<TabStripModelDelegate> tab_strip_model_delegate_; 811 scoped_ptr<TabStripModelDelegate> tab_strip_model_delegate_;
816 scoped_ptr<TabStripModel> tab_strip_model_; 812 scoped_ptr<TabStripModel> tab_strip_model_;
817 813
818 // The application name that is also the name of the window to the shell. 814 // The application name that is also the name of the window to the shell.
819 // This name should be set when: 815 // This name should be set when:
820 // 1) we launch an application via an application shortcut or extension API. 816 // 1) we launch an application via an application shortcut or extension API.
821 // 2) we launch an undocked devtool window. 817 // 2) we launch an undocked devtool window.
822 std::string app_name_; 818 std::string app_name_;
823 819
824 // Type of app (host or child). See description of AppType.
825 AppType app_type_;
826
827 // Unique identifier of this browser for session restore. This id is only 820 // Unique identifier of this browser for session restore. This id is only
828 // unique within the current session, and is not guaranteed to be unique 821 // unique within the current session, and is not guaranteed to be unique
829 // across sessions. 822 // across sessions.
830 const SessionID session_id_; 823 const SessionID session_id_;
831 824
832 // The model for the toolbar view. 825 // The model for the toolbar view.
833 scoped_ptr<ToolbarModel> toolbar_model_; 826 scoped_ptr<ToolbarModel> toolbar_model_;
834 827
835 // The model for the "active" search state. There are per-tab search models 828 // The model for the "active" search state. There are per-tab search models
836 // as well. When a tab is active its model is kept in sync with this one. 829 // 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
928 base::WeakPtrFactory<Browser> weak_factory_; 921 base::WeakPtrFactory<Browser> weak_factory_;
929 922
930 scoped_ptr<BrowserContentTranslateDriverObserver> translate_driver_observer_; 923 scoped_ptr<BrowserContentTranslateDriverObserver> translate_driver_observer_;
931 924
932 scoped_ptr<chrome::ValidationMessageBubble> validation_message_bubble_; 925 scoped_ptr<chrome::ValidationMessageBubble> validation_message_bubble_;
933 926
934 DISALLOW_COPY_AND_ASSIGN(Browser); 927 DISALLOW_COPY_AND_ASSIGN(Browser);
935 }; 928 };
936 929
937 #endif // CHROME_BROWSER_UI_BROWSER_H_ 930 #endif // CHROME_BROWSER_UI_BROWSER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698