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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 #include "chrome/common/content_settings_types.h" | 45 #include "chrome/common/content_settings_types.h" |
46 #include "chrome/common/extensions/extension_constants.h" | 46 #include "chrome/common/extensions/extension_constants.h" |
47 #include "content/public/browser/notification_registrar.h" | 47 #include "content/public/browser/notification_registrar.h" |
48 #include "content/public/browser/page_navigator.h" | 48 #include "content/public/browser/page_navigator.h" |
49 #include "content/public/browser/web_contents_delegate.h" | 49 #include "content/public/browser/web_contents_delegate.h" |
50 #include "content/public/common/page_transition_types.h" | 50 #include "content/public/common/page_transition_types.h" |
51 #include "content/public/common/page_zoom.h" | 51 #include "content/public/common/page_zoom.h" |
52 #include "ui/base/ui_base_types.h" | 52 #include "ui/base/ui_base_types.h" |
53 #include "ui/gfx/rect.h" | 53 #include "ui/gfx/rect.h" |
54 | 54 |
55 class BrowserContentSettingBubbleModelDelegate; | |
55 class BrowserSyncedWindowDelegate; | 56 class BrowserSyncedWindowDelegate; |
57 class BrowserToolbarModelHost; | |
56 class BrowserTabRestoreServiceDelegate; | 58 class BrowserTabRestoreServiceDelegate; |
57 class BrowserWindow; | 59 class BrowserWindow; |
58 class Extension; | 60 class Extension; |
59 class ExtensionWindowController; | 61 class ExtensionWindowController; |
60 class FindBarController; | 62 class FindBarController; |
61 class FullscreenController; | 63 class FullscreenController; |
62 class HtmlDialogUIDelegate; | 64 class HtmlDialogUIDelegate; |
63 class InstantController; | 65 class InstantController; |
64 class InstantUnloadHandler; | 66 class InstantUnloadHandler; |
65 class PrefService; | 67 class PrefService; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 Profile* profile() const { return profile_; } | 229 Profile* profile() const { return profile_; } |
228 gfx::Rect override_bounds() const { return override_bounds_; } | 230 gfx::Rect override_bounds() const { return override_bounds_; } |
229 | 231 |
230 // Returns the InstantController or NULL if there is no InstantController for | 232 // Returns the InstantController or NULL if there is no InstantController for |
231 // this Browser. | 233 // this Browser. |
232 InstantController* instant() const { return instant_.get(); } | 234 InstantController* instant() const { return instant_.get(); } |
233 | 235 |
234 // |window()| will return NULL if called before |CreateBrowserWindow()| | 236 // |window()| will return NULL if called before |CreateBrowserWindow()| |
235 // is done. | 237 // is done. |
236 BrowserWindow* window() const { return window_; } | 238 BrowserWindow* window() const { return window_; } |
237 ToolbarModel* toolbar_model() { return &toolbar_model_; } | 239 ToolbarModel* toolbar_model() { return toolbar_model_.get(); } |
238 const SessionID& session_id() const { return session_id_; } | 240 const SessionID& session_id() const { return session_id_; } |
239 CommandUpdater* command_updater() { return &command_updater_; } | 241 CommandUpdater* command_updater() { return &command_updater_; } |
240 bool block_command_execution() const { return block_command_execution_; } | 242 bool block_command_execution() const { return block_command_execution_; } |
243 BrowserContentSettingBubbleModelDelegate* | |
244 content_setting_bubble_model_delegate() { | |
245 return content_setting_bubble_model_delegate_.get(); | |
246 } | |
241 BrowserTabRestoreServiceDelegate* tab_restore_service_delegate() { | 247 BrowserTabRestoreServiceDelegate* tab_restore_service_delegate() { |
242 return tab_restore_service_delegate_.get(); | 248 return tab_restore_service_delegate_.get(); |
243 } | 249 } |
244 BrowserSyncedWindowDelegate* synced_window_delegate() { | 250 BrowserSyncedWindowDelegate* synced_window_delegate() { |
245 return synced_window_delegate_.get(); | 251 return synced_window_delegate_.get(); |
246 } | 252 } |
247 | 253 |
248 // Get the FindBarController for this browser, creating it if it does not | 254 // Get the FindBarController for this browser, creating it if it does not |
249 // yet exist. | 255 // yet exist. |
250 FindBarController* GetFindBarController(); | 256 FindBarController* GetFindBarController(); |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
741 bool final_update); | 747 bool final_update); |
742 | 748 |
743 // Helper function to handle crashed plugin notifications. | 749 // Helper function to handle crashed plugin notifications. |
744 static void CrashedPluginHelper(content::WebContents* tab, | 750 static void CrashedPluginHelper(content::WebContents* tab, |
745 const FilePath& plugin_path); | 751 const FilePath& plugin_path); |
746 | 752 |
747 // Helper function to handle url update notifications. | 753 // Helper function to handle url update notifications. |
748 static void UpdateTargetURLHelper(content::WebContents* tab, int32 page_id, | 754 static void UpdateTargetURLHelper(content::WebContents* tab, int32 page_id, |
749 const GURL& url); | 755 const GURL& url); |
750 | 756 |
751 // Calls ExecuteCommandWithDisposition with the given disposition. | 757 // Calls ExecuteCommandWithDisposition with CURRENT_TAB disposition. |
752 void ExecuteCommandWithDisposition(int id, WindowOpenDisposition); | 758 void ExecuteCommand(int id); |
753 | 759 |
754 // Calls ExecuteCommandWithDisposition with the given event flags. | 760 // Calls ExecuteCommandWithDisposition with the given event flags. |
755 void ExecuteCommand(int id, int event_flags); | 761 void ExecuteCommand(int id, int event_flags); |
756 | 762 |
757 // Executes a command if it's enabled. | 763 // Executes a command if it's enabled. |
758 // Returns true if the command is executed. | 764 // Returns true if the command is executed. |
759 bool ExecuteCommandIfEnabled(int id); | 765 bool ExecuteCommandIfEnabled(int id); |
760 | 766 |
761 // Returns true if |command_id| is a reserved command whose keyboard shortcuts | 767 // Returns true if |command_id| is a reserved command whose keyboard shortcuts |
762 // should not be sent to the renderer or |event| was triggered by a key that | 768 // should not be sent to the renderer or |event| was triggered by a key that |
(...skipping 22 matching lines...) Expand all Loading... | |
785 // Shows the cookies collected in the tab contents wrapper. | 791 // Shows the cookies collected in the tab contents wrapper. |
786 void ShowCollectedCookiesDialog(TabContentsWrapper* wrapper); | 792 void ShowCollectedCookiesDialog(TabContentsWrapper* wrapper); |
787 | 793 |
788 // Interface implementations //////////////////////////////////////////////// | 794 // Interface implementations //////////////////////////////////////////////// |
789 | 795 |
790 // Overridden from content::PageNavigator: | 796 // Overridden from content::PageNavigator: |
791 virtual content::WebContents* OpenURL( | 797 virtual content::WebContents* OpenURL( |
792 const content::OpenURLParams& params) OVERRIDE; | 798 const content::OpenURLParams& params) OVERRIDE; |
793 | 799 |
794 // Overridden from CommandUpdater::CommandUpdaterDelegate: | 800 // Overridden from CommandUpdater::CommandUpdaterDelegate: |
795 virtual void ExecuteCommand(int id) OVERRIDE; | 801 virtual void ExecuteCommandWithDisposition( |
802 int id, WindowOpenDisposition disposition) OVERRIDE; | |
sky
2012/03/12 20:59:19
nit: once you wrap you shouldn't have multiple par
altimofeev
2012/03/13 15:38:05
Done.
| |
796 | 803 |
797 // Overridden from TabRestoreServiceObserver: | 804 // Overridden from TabRestoreServiceObserver: |
798 virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE; | 805 virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE; |
799 virtual void TabRestoreServiceDestroyed(TabRestoreService* service) OVERRIDE; | 806 virtual void TabRestoreServiceDestroyed(TabRestoreService* service) OVERRIDE; |
800 | 807 |
801 // Centralized method for creating a TabContents, configuring and installing | 808 // Centralized method for creating a TabContents, configuring and installing |
802 // all its supporting objects and observers. | 809 // all its supporting objects and observers. |
803 static TabContentsWrapper* TabContentsFactory( | 810 static TabContentsWrapper* TabContentsFactory( |
804 Profile* profile, | 811 Profile* profile, |
805 content::SiteInstance* site_instance, | 812 content::SiteInstance* site_instance, |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1354 // 1) we launch an application via an application shortcut or extension API. | 1361 // 1) we launch an application via an application shortcut or extension API. |
1355 // 2) we launch an undocked devtool window. | 1362 // 2) we launch an undocked devtool window. |
1356 std::string app_name_; | 1363 std::string app_name_; |
1357 | 1364 |
1358 // Unique identifier of this browser for session restore. This id is only | 1365 // Unique identifier of this browser for session restore. This id is only |
1359 // unique within the current session, and is not guaranteed to be unique | 1366 // unique within the current session, and is not guaranteed to be unique |
1360 // across sessions. | 1367 // across sessions. |
1361 const SessionID session_id_; | 1368 const SessionID session_id_; |
1362 | 1369 |
1363 // The model for the toolbar view. | 1370 // The model for the toolbar view. |
1364 ToolbarModel toolbar_model_; | 1371 scoped_ptr<ToolbarModel> toolbar_model_; |
1365 | 1372 |
1366 // UI update coalescing and handling //////////////////////////////////////// | 1373 // UI update coalescing and handling //////////////////////////////////////// |
1367 | 1374 |
1368 typedef std::map<const content::WebContents*, int> UpdateMap; | 1375 typedef std::map<const content::WebContents*, int> UpdateMap; |
1369 | 1376 |
1370 // Maps from TabContents to pending UI updates that need to be processed. | 1377 // Maps from TabContents to pending UI updates that need to be processed. |
1371 // We don't update things like the URL or tab title right away to avoid | 1378 // We don't update things like the URL or tab title right away to avoid |
1372 // flickering and extra painting. | 1379 // flickering and extra painting. |
1373 // See ScheduleUIUpdate and ProcessPendingUIUpdates. | 1380 // See ScheduleUIUpdate and ProcessPendingUIUpdates. |
1374 UpdateMap scheduled_updates_; | 1381 UpdateMap scheduled_updates_; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1448 }; | 1455 }; |
1449 | 1456 |
1450 // Which deferred action to perform when OnDidGetApplicationInfo is notified | 1457 // Which deferred action to perform when OnDidGetApplicationInfo is notified |
1451 // from a TabContents. Currently, only one pending action is allowed. | 1458 // from a TabContents. Currently, only one pending action is allowed. |
1452 WebAppAction pending_web_app_action_; | 1459 WebAppAction pending_web_app_action_; |
1453 | 1460 |
1454 // The profile's tab restore service. The service is owned by the profile, | 1461 // The profile's tab restore service. The service is owned by the profile, |
1455 // and we install ourselves as an observer. | 1462 // and we install ourselves as an observer. |
1456 TabRestoreService* tab_restore_service_; | 1463 TabRestoreService* tab_restore_service_; |
1457 | 1464 |
1465 // Helper which implements the ContentSettingBubbleModel interface. | |
1466 scoped_ptr<BrowserContentSettingBubbleModelDelegate> | |
1467 content_setting_bubble_model_delegate_; | |
1468 | |
1469 // Helper which implements the ToolbarModelHost interface. | |
1470 scoped_ptr<BrowserToolbarModelHost> toolbar_model_host_; | |
1471 | |
1458 // Helper which implements the TabRestoreServiceDelegate interface. | 1472 // Helper which implements the TabRestoreServiceDelegate interface. |
1459 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; | 1473 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; |
1460 | 1474 |
1461 // Helper which implements the SyncedWindowDelegate interface. | 1475 // Helper which implements the SyncedWindowDelegate interface. |
1462 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; | 1476 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; |
1463 | 1477 |
1464 scoped_ptr<InstantController> instant_; | 1478 scoped_ptr<InstantController> instant_; |
1465 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; | 1479 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; |
1466 | 1480 |
1467 BookmarkBar::State bookmark_bar_state_; | 1481 BookmarkBar::State bookmark_bar_state_; |
1468 | 1482 |
1469 scoped_refptr<FullscreenController> fullscreen_controller_; | 1483 scoped_refptr<FullscreenController> fullscreen_controller_; |
1470 | 1484 |
1471 scoped_ptr<ExtensionWindowController> extension_window_controller_; | 1485 scoped_ptr<ExtensionWindowController> extension_window_controller_; |
1472 | 1486 |
1473 // True if the browser window has been shown at least once. | 1487 // True if the browser window has been shown at least once. |
1474 bool window_has_shown_; | 1488 bool window_has_shown_; |
1475 | 1489 |
1476 DISALLOW_COPY_AND_ASSIGN(Browser); | 1490 DISALLOW_COPY_AND_ASSIGN(Browser); |
1477 }; | 1491 }; |
1478 | 1492 |
1479 #endif // CHROME_BROWSER_UI_BROWSER_H_ | 1493 #endif // CHROME_BROWSER_UI_BROWSER_H_ |
OLD | NEW |