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

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

Issue 9479008: Re-factor location bar/toolbar code to get rid of the browser dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: call right overloaded method Created 8 years, 9 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
« no previous file with comments | « chrome/browser/sync/sync_global_error_unittest.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 BrowserToolbarModelDelegate;
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
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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 bool final_update); 748 bool final_update);
743 749
744 // Helper function to handle crashed plugin notifications. 750 // Helper function to handle crashed plugin notifications.
745 static void CrashedPluginHelper(content::WebContents* tab, 751 static void CrashedPluginHelper(content::WebContents* tab,
746 const FilePath& plugin_path); 752 const FilePath& plugin_path);
747 753
748 // Helper function to handle url update notifications. 754 // Helper function to handle url update notifications.
749 static void UpdateTargetURLHelper(content::WebContents* tab, int32 page_id, 755 static void UpdateTargetURLHelper(content::WebContents* tab, int32 page_id,
750 const GURL& url); 756 const GURL& url);
751 757
752 // Calls ExecuteCommandWithDisposition with the given disposition. 758 // Calls ExecuteCommandWithDisposition with CURRENT_TAB disposition.
753 void ExecuteCommandWithDisposition(int id, WindowOpenDisposition); 759 void ExecuteCommand(int id);
754 760
755 // Calls ExecuteCommandWithDisposition with the given event flags. 761 // Calls ExecuteCommandWithDisposition with the given event flags.
756 void ExecuteCommand(int id, int event_flags); 762 void ExecuteCommand(int id, int event_flags);
757 763
758 // Executes a command if it's enabled. 764 // Executes a command if it's enabled.
759 // Returns true if the command is executed. 765 // Returns true if the command is executed.
760 bool ExecuteCommandIfEnabled(int id); 766 bool ExecuteCommandIfEnabled(int id);
761 767
762 // Returns true if |command_id| is a reserved command whose keyboard shortcuts 768 // Returns true if |command_id| is a reserved command whose keyboard shortcuts
763 // should not be sent to the renderer or |event| was triggered by a key that 769 // should not be sent to the renderer or |event| was triggered by a key that
(...skipping 22 matching lines...) Expand all
786 // Shows the cookies collected in the tab contents wrapper. 792 // Shows the cookies collected in the tab contents wrapper.
787 void ShowCollectedCookiesDialog(TabContentsWrapper* wrapper); 793 void ShowCollectedCookiesDialog(TabContentsWrapper* wrapper);
788 794
789 // Interface implementations //////////////////////////////////////////////// 795 // Interface implementations ////////////////////////////////////////////////
790 796
791 // Overridden from content::PageNavigator: 797 // Overridden from content::PageNavigator:
792 virtual content::WebContents* OpenURL( 798 virtual content::WebContents* OpenURL(
793 const content::OpenURLParams& params) OVERRIDE; 799 const content::OpenURLParams& params) OVERRIDE;
794 800
795 // Overridden from CommandUpdater::CommandUpdaterDelegate: 801 // Overridden from CommandUpdater::CommandUpdaterDelegate:
796 virtual void ExecuteCommand(int id) OVERRIDE; 802 virtual void ExecuteCommandWithDisposition(
803 int id,
804 WindowOpenDisposition disposition) OVERRIDE;
797 805
798 // Overridden from TabRestoreServiceObserver: 806 // Overridden from TabRestoreServiceObserver:
799 virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE; 807 virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE;
800 virtual void TabRestoreServiceDestroyed(TabRestoreService* service) OVERRIDE; 808 virtual void TabRestoreServiceDestroyed(TabRestoreService* service) OVERRIDE;
801 809
802 // Centralized method for creating a TabContents, configuring and installing 810 // Centralized method for creating a TabContents, configuring and installing
803 // all its supporting objects and observers. 811 // all its supporting objects and observers.
804 static TabContentsWrapper* TabContentsFactory( 812 static TabContentsWrapper* TabContentsFactory(
805 Profile* profile, 813 Profile* profile,
806 content::SiteInstance* site_instance, 814 content::SiteInstance* site_instance,
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 // 1) we launch an application via an application shortcut or extension API. 1363 // 1) we launch an application via an application shortcut or extension API.
1356 // 2) we launch an undocked devtool window. 1364 // 2) we launch an undocked devtool window.
1357 std::string app_name_; 1365 std::string app_name_;
1358 1366
1359 // Unique identifier of this browser for session restore. This id is only 1367 // Unique identifier of this browser for session restore. This id is only
1360 // unique within the current session, and is not guaranteed to be unique 1368 // unique within the current session, and is not guaranteed to be unique
1361 // across sessions. 1369 // across sessions.
1362 const SessionID session_id_; 1370 const SessionID session_id_;
1363 1371
1364 // The model for the toolbar view. 1372 // The model for the toolbar view.
1365 ToolbarModel toolbar_model_; 1373 scoped_ptr<ToolbarModel> toolbar_model_;
1366 1374
1367 // UI update coalescing and handling //////////////////////////////////////// 1375 // UI update coalescing and handling ////////////////////////////////////////
1368 1376
1369 typedef std::map<const content::WebContents*, int> UpdateMap; 1377 typedef std::map<const content::WebContents*, int> UpdateMap;
1370 1378
1371 // Maps from TabContents to pending UI updates that need to be processed. 1379 // Maps from TabContents to pending UI updates that need to be processed.
1372 // We don't update things like the URL or tab title right away to avoid 1380 // We don't update things like the URL or tab title right away to avoid
1373 // flickering and extra painting. 1381 // flickering and extra painting.
1374 // See ScheduleUIUpdate and ProcessPendingUIUpdates. 1382 // See ScheduleUIUpdate and ProcessPendingUIUpdates.
1375 UpdateMap scheduled_updates_; 1383 UpdateMap scheduled_updates_;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 }; 1457 };
1450 1458
1451 // Which deferred action to perform when OnDidGetApplicationInfo is notified 1459 // Which deferred action to perform when OnDidGetApplicationInfo is notified
1452 // from a TabContents. Currently, only one pending action is allowed. 1460 // from a TabContents. Currently, only one pending action is allowed.
1453 WebAppAction pending_web_app_action_; 1461 WebAppAction pending_web_app_action_;
1454 1462
1455 // The profile's tab restore service. The service is owned by the profile, 1463 // The profile's tab restore service. The service is owned by the profile,
1456 // and we install ourselves as an observer. 1464 // and we install ourselves as an observer.
1457 TabRestoreService* tab_restore_service_; 1465 TabRestoreService* tab_restore_service_;
1458 1466
1467 // Helper which implements the ContentSettingBubbleModel interface.
1468 scoped_ptr<BrowserContentSettingBubbleModelDelegate>
1469 content_setting_bubble_model_delegate_;
1470
1471 // Helper which implements the ToolbarModelDelegate interface.
1472 scoped_ptr<BrowserToolbarModelDelegate> toolbar_model_delegate_;
1473
1459 // Helper which implements the TabRestoreServiceDelegate interface. 1474 // Helper which implements the TabRestoreServiceDelegate interface.
1460 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; 1475 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_;
1461 1476
1462 // Helper which implements the SyncedWindowDelegate interface. 1477 // Helper which implements the SyncedWindowDelegate interface.
1463 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; 1478 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_;
1464 1479
1465 scoped_ptr<InstantController> instant_; 1480 scoped_ptr<InstantController> instant_;
1466 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; 1481 scoped_ptr<InstantUnloadHandler> instant_unload_handler_;
1467 1482
1468 BookmarkBar::State bookmark_bar_state_; 1483 BookmarkBar::State bookmark_bar_state_;
1469 1484
1470 scoped_refptr<FullscreenController> fullscreen_controller_; 1485 scoped_refptr<FullscreenController> fullscreen_controller_;
1471 1486
1472 scoped_ptr<ExtensionWindowController> extension_window_controller_; 1487 scoped_ptr<ExtensionWindowController> extension_window_controller_;
1473 1488
1474 // True if the browser window has been shown at least once. 1489 // True if the browser window has been shown at least once.
1475 bool window_has_shown_; 1490 bool window_has_shown_;
1476 1491
1477 DISALLOW_COPY_AND_ASSIGN(Browser); 1492 DISALLOW_COPY_AND_ASSIGN(Browser);
1478 }; 1493 };
1479 1494
1480 #endif // CHROME_BROWSER_UI_BROWSER_H_ 1495 #endif // CHROME_BROWSER_UI_BROWSER_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_global_error_unittest.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698