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

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

Issue 10409023: Remove extension application launch code from Browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Browser stuff removed; compiles Created 8 years, 7 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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // updated. 102 // updated.
103 enum Type { 103 enum Type {
104 // If you add a new type, consider updating the test 104 // If you add a new type, consider updating the test
105 // BrowserTest.StartMaximized. 105 // BrowserTest.StartMaximized.
106 TYPE_TABBED = 1, 106 TYPE_TABBED = 1,
107 TYPE_POPUP = 2, 107 TYPE_POPUP = 2,
108 TYPE_PANEL = 3 108 TYPE_PANEL = 3
109 }; 109 };
110 110
111 // Distinguishes between browsers that host an app (opened from 111 // Distinguishes between browsers that host an app (opened from
112 // Browser::OpenApplication), and child browsers created by an app from 112 // ApplicationLauncher::OpenApplication), and child browsers created by an app
113 // Browser::CreateForApp (e.g. by windows.open or the extension API). 113 // from Browser::CreateForApp (e.g. by windows.open or the extension API).
114 // TODO(stevenjb): This is currently only needed by the ash Launcher for 114 // TODO(stevenjb): This is currently only needed by the ash Launcher for
115 // identifying child panels. Remove this once panels are no longer 115 // identifying child panels. Remove this once panels are no longer
116 // implemented as Browsers, crbug.com/112198. 116 // implemented as Browsers, crbug.com/112198.
117 enum AppType { 117 enum AppType {
118 APP_TYPE_HOST = 1, 118 APP_TYPE_HOST = 1,
119 APP_TYPE_CHILD = 2 119 APP_TYPE_CHILD = 2
120 }; 120 };
121 121
122 // Possible elements of the Browser window. 122 // Possible elements of the Browser window.
123 enum WindowFeature { 123 enum WindowFeature {
(...skipping 15 matching lines...) Expand all
139 139
140 // The browser is shutting down and there are active downloads 140 // The browser is shutting down and there are active downloads
141 // that would be cancelled. 141 // that would be cancelled.
142 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN, 142 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN,
143 143
144 // There are active downloads associated with this incognito profile 144 // There are active downloads associated with this incognito profile
145 // that would be canceled. 145 // that would be canceled.
146 DOWNLOAD_CLOSE_LAST_WINDOW_IN_INCOGNITO_PROFILE, 146 DOWNLOAD_CLOSE_LAST_WINDOW_IN_INCOGNITO_PROFILE,
147 }; 147 };
148 148
149 // Different types of action when web app info is available.
150 // OnDidGetApplicationInfo uses this to dispatch calls.
151 enum WebAppAction {
152 NONE, // No action at all.
153 CREATE_SHORTCUT, // Bring up create application shortcut dialog.
154 UPDATE_SHORTCUT // Update icon for app shortcut.
155 };
156
149 struct CreateParams { 157 struct CreateParams {
150 CreateParams(); 158 CreateParams();
151 CreateParams(Type type, Profile* profile); 159 CreateParams(Type type, Profile* profile);
152 160
153 static CreateParams CreateForApp(Type type, 161 static CreateParams CreateForApp(Type type,
154 const std::string& app_name, 162 const std::string& app_name,
155 const gfx::Rect& window_bounds, 163 const gfx::Rect& window_bounds,
156 Profile* profile); 164 Profile* profile);
157 165
158 static CreateParams CreateForDevTools(Profile* profile); 166 static CreateParams CreateForDevTools(Profile* profile);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 static Browser* OpenEmptyWindow(Profile* profile); 286 static Browser* OpenEmptyWindow(Profile* profile);
279 287
280 // Opens a new window with the tabs from |profile|'s TabRestoreService. 288 // Opens a new window with the tabs from |profile|'s TabRestoreService.
281 static void OpenWindowWithRestoredTabs(Profile* profile); 289 static void OpenWindowWithRestoredTabs(Profile* profile);
282 290
283 // Opens the specified URL in a new browser window in an incognito session. 291 // Opens the specified URL in a new browser window in an incognito session.
284 // If there is already an existing active incognito session for the specified 292 // If there is already an existing active incognito session for the specified
285 // |profile|, that session is re-used. 293 // |profile|, that session is re-used.
286 static void OpenURLOffTheRecord(Profile* profile, const GURL& url); 294 static void OpenURLOffTheRecord(Profile* profile, const GURL& url);
287 295
288 // Open |extension| in |container|, using |disposition| if container type is
289 // TAB. Returns the WebContents* that was created or NULL. If non-empty,
290 // |override_url| is used in place of the app launch url.
291 static content::WebContents* OpenApplication(
292 Profile* profile,
293 const Extension* extension,
294 extension_misc::LaunchContainer container,
295 const GURL& override_url,
296 WindowOpenDisposition disposition);
297
298 #if defined(USE_ASH)
299 // Opens |url| in a new application panel window for the specified url.
300 static content::WebContents* OpenApplicationPanel(
301 Profile* profile,
302 const Extension* extension,
303 const GURL& url);
304 #endif
305
306 // Opens a new application window for the specified url. If |as_panel|
307 // is true, the application will be opened as a Browser::Type::APP_PANEL in
308 // app panel window, otherwise it will be opened as as either
309 // Browser::Type::APP a.k.a. "thin frame" (if |extension| is NULL) or
310 // Browser::Type::EXTENSION_APP (if |extension| is non-NULL).
311 // If |app_browser| is not NULL, it is set to the browser that hosts the
312 // returned tab.
313 static content::WebContents* OpenApplicationWindow(
314 Profile* profile,
315 const Extension* extension,
316 extension_misc::LaunchContainer container,
317 const GURL& url,
318 Browser** app_browser);
319
320 // Open |url| in an app shortcut window. If |update_shortcut| is true,
321 // update the name, description, and favicon of the shortcut.
322 // There are two kinds of app shortcuts: Shortcuts to a URL,
323 // and shortcuts that open an installed application. This function
324 // is used to open the former. To open the latter, use
325 // Browser::OpenApplicationWindow().
326 static content::WebContents* OpenAppShortcutWindow(Profile* profile,
327 const GURL& url,
328 bool update_shortcut);
329
330 // Open an application for |extension| using |disposition|. Returns NULL if
331 // there are no appropriate existing browser windows for |profile|. If
332 // non-empty, |override_url| is used in place of the app launch url.
333 static content::WebContents* OpenApplicationTab(
334 Profile* profile,
335 const Extension* extension,
336 const GURL& override_url,
337 WindowOpenDisposition disposition);
338
339 // Opens a new window and opens the bookmark manager. 296 // Opens a new window and opens the bookmark manager.
340 static void OpenBookmarkManagerWindow(Profile* profile); 297 static void OpenBookmarkManagerWindow(Profile* profile);
341 298
342 #if defined(OS_MACOSX) 299 #if defined(OS_MACOSX)
343 // Open a new window with history/downloads/help/options (needed on Mac when 300 // Open a new window with history/downloads/help/options (needed on Mac when
344 // there are no windows). 301 // there are no windows).
345 static void OpenAboutWindow(Profile* profile); 302 static void OpenAboutWindow(Profile* profile);
346 static void OpenHistoryWindow(Profile* profile); 303 static void OpenHistoryWindow(Profile* profile);
347 static void OpenDownloadsWindow(Profile* profile); 304 static void OpenDownloadsWindow(Profile* profile);
348 static void OpenHelpWindow(Profile* profile); 305 static void OpenHelpWindow(Profile* profile);
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 810
854 // True when the mouse cursor is locked. 811 // True when the mouse cursor is locked.
855 bool IsMouseLocked() const; 812 bool IsMouseLocked() const;
856 813
857 // Called each time the browser window is shown. 814 // Called each time the browser window is shown.
858 void OnWindowDidShow(); 815 void OnWindowDidShow();
859 816
860 // Show the first run search engine bubble on the location bar. 817 // Show the first run search engine bubble on the location bar.
861 void ShowFirstRunBubble(); 818 void ShowFirstRunBubble();
862 819
820 void set_pending_web_app_action(WebAppAction action) {
821 pending_web_app_action_ = action;
sky 2012/05/18 16:04:02 It would be great if we could remove this too.
benwells 2012/05/21 03:25:54 I couldn't see a way to get rid of this, but I don
822 }
823
863 ExtensionWindowController* extension_window_controller() const { 824 ExtensionWindowController* extension_window_controller() const {
864 return extension_window_controller_.get(); 825 return extension_window_controller_.get();
865 } 826 }
866 827
867 protected: 828 protected:
868 // Wrapper for the factory method in BrowserWindow. This allows subclasses to 829 // Wrapper for the factory method in BrowserWindow. This allows subclasses to
869 // set their own window. 830 // set their own window.
870 virtual BrowserWindow* CreateBrowserWindow(); 831 virtual BrowserWindow* CreateBrowserWindow();
871 832
872 private: 833 private:
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 1371
1411 // Indicates if command execution is blocked. 1372 // Indicates if command execution is blocked.
1412 bool block_command_execution_; 1373 bool block_command_execution_;
1413 1374
1414 // Stores the last blocked command id when |block_command_execution_| is true. 1375 // Stores the last blocked command id when |block_command_execution_| is true.
1415 int last_blocked_command_id_; 1376 int last_blocked_command_id_;
1416 1377
1417 // Stores the disposition type of the last blocked command. 1378 // Stores the disposition type of the last blocked command.
1418 WindowOpenDisposition last_blocked_command_disposition_; 1379 WindowOpenDisposition last_blocked_command_disposition_;
1419 1380
1420 // Different types of action when web app info is available.
1421 // OnDidGetApplicationInfo uses this to dispatch calls.
1422 enum WebAppAction {
1423 NONE, // No action at all.
1424 CREATE_SHORTCUT, // Bring up create application shortcut dialog.
1425 UPDATE_SHORTCUT // Update icon for app shortcut.
1426 };
1427
1428 // Which deferred action to perform when OnDidGetApplicationInfo is notified 1381 // Which deferred action to perform when OnDidGetApplicationInfo is notified
1429 // from a WebContents. Currently, only one pending action is allowed. 1382 // from a WebContents. Currently, only one pending action is allowed.
1430 WebAppAction pending_web_app_action_; 1383 WebAppAction pending_web_app_action_;
1431 1384
1432 // The profile's tab restore service. The service is owned by the profile, 1385 // The profile's tab restore service. The service is owned by the profile,
1433 // and we install ourselves as an observer. 1386 // and we install ourselves as an observer.
1434 TabRestoreService* tab_restore_service_; 1387 TabRestoreService* tab_restore_service_;
1435 1388
1436 // Helper which implements the ContentSettingBubbleModel interface. 1389 // Helper which implements the ContentSettingBubbleModel interface.
1437 scoped_ptr<BrowserContentSettingBubbleModelDelegate> 1390 scoped_ptr<BrowserContentSettingBubbleModelDelegate>
(...skipping 21 matching lines...) Expand all
1459 bool window_has_shown_; 1412 bool window_has_shown_;
1460 1413
1461 // Currently open color chooser. Non-NULL after OpenColorChooser is called and 1414 // Currently open color chooser. Non-NULL after OpenColorChooser is called and
1462 // before DidEndColorChooser is called. 1415 // before DidEndColorChooser is called.
1463 scoped_ptr<content::ColorChooser> color_chooser_; 1416 scoped_ptr<content::ColorChooser> color_chooser_;
1464 1417
1465 DISALLOW_COPY_AND_ASSIGN(Browser); 1418 DISALLOW_COPY_AND_ASSIGN(Browser);
1466 }; 1419 };
1467 1420
1468 #endif // CHROME_BROWSER_UI_BROWSER_H_ 1421 #endif // CHROME_BROWSER_UI_BROWSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698