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

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

Issue 10703131: Move Instant stuff off Browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/gtest_prod_util.h" 16 #include "base/gtest_prod_util.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/string16.h" 19 #include "base/string16.h"
20 #include "chrome/browser/debugger/devtools_toggle_action.h" 20 #include "chrome/browser/debugger/devtools_toggle_action.h"
21 #include "chrome/browser/event_disposition.h" 21 #include "chrome/browser/event_disposition.h"
22 #include "chrome/browser/instant/instant_controller_delegate.h"
23 #include "chrome/browser/intents/device_attached_intent_source.h" 22 #include "chrome/browser/intents/device_attached_intent_source.h"
24 #include "chrome/browser/prefs/pref_change_registrar.h" 23 #include "chrome/browser/prefs/pref_change_registrar.h"
25 #include "chrome/browser/prefs/pref_member.h" 24 #include "chrome/browser/prefs/pref_member.h"
26 #include "chrome/browser/sessions/session_id.h" 25 #include "chrome/browser/sessions/session_id.h"
27 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate. h" 26 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate. h"
28 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" 27 #include "chrome/browser/ui/bookmarks/bookmark_bar.h"
29 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper_delegate.h" 28 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper_delegate.h"
30 #include "chrome/browser/ui/browser_navigator.h" 29 #include "chrome/browser/ui/browser_navigator.h"
31 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" 30 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h"
32 #include "chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h" 31 #include "chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h"
(...skipping 14 matching lines...) Expand all
47 #include "ui/gfx/rect.h" 46 #include "ui/gfx/rect.h"
48 47
49 class BrowserContentSettingBubbleModelDelegate; 48 class BrowserContentSettingBubbleModelDelegate;
50 class BrowserSyncedWindowDelegate; 49 class BrowserSyncedWindowDelegate;
51 class BrowserToolbarModelDelegate; 50 class BrowserToolbarModelDelegate;
52 class BrowserTabRestoreServiceDelegate; 51 class BrowserTabRestoreServiceDelegate;
53 class BrowserWindow; 52 class BrowserWindow;
54 class ExtensionWindowController; 53 class ExtensionWindowController;
55 class FindBarController; 54 class FindBarController;
56 class FullscreenController; 55 class FullscreenController;
57 class InstantController;
58 class InstantUnloadHandler;
59 class PrefService; 56 class PrefService;
60 class Profile; 57 class Profile;
61 class SkBitmap; 58 class SkBitmap;
62 class StatusBubble; 59 class StatusBubble;
63 class TabNavigation; 60 class TabNavigation;
64 class TabStripModel; 61 class TabStripModel;
65 class TabStripModelDelegate; 62 class TabStripModelDelegate;
66 struct WebApplicationInfo; 63 struct WebApplicationInfo;
67 64
68 namespace chrome { 65 namespace chrome {
69 class BrowserCommandController; 66 class BrowserCommandController;
67 class BrowserInstantController;
70 class UnloadController; 68 class UnloadController;
71 namespace search { 69 namespace search {
72 class SearchDelegate; 70 class SearchDelegate;
73 class SearchModel; 71 class SearchModel;
74 } 72 }
75 } 73 }
76 74
77 namespace content { 75 namespace content {
78 class NavigationController; 76 class NavigationController;
79 class SessionStorageNamespace; 77 class SessionStorageNamespace;
(...skipping 18 matching lines...) Expand all
98 class Browser : public TabStripModelObserver, 96 class Browser : public TabStripModelObserver,
99 public content::WebContentsDelegate, 97 public content::WebContentsDelegate,
100 public CoreTabHelperDelegate, 98 public CoreTabHelperDelegate,
101 public SearchEngineTabHelperDelegate, 99 public SearchEngineTabHelperDelegate,
102 public ConstrainedWindowTabHelperDelegate, 100 public ConstrainedWindowTabHelperDelegate,
103 public BlockedContentTabHelperDelegate, 101 public BlockedContentTabHelperDelegate,
104 public BookmarkTabHelperDelegate, 102 public BookmarkTabHelperDelegate,
105 public ZoomObserver, 103 public ZoomObserver,
106 public content::PageNavigator, 104 public content::PageNavigator,
107 public content::NotificationObserver, 105 public content::NotificationObserver,
108 public SelectFileDialog::Listener, 106 public SelectFileDialog::Listener {
109 public InstantControllerDelegate {
110 public: 107 public:
111 // SessionService::WindowType mirrors these values. If you add to this 108 // SessionService::WindowType mirrors these values. If you add to this
112 // 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
113 // updated. 110 // updated.
114 enum Type { 111 enum Type {
115 // If you add a new type, consider updating the test 112 // If you add a new type, consider updating the test
116 // BrowserTest.StartMaximized. 113 // BrowserTest.StartMaximized.
117 TYPE_TABBED = 1, 114 TYPE_TABBED = 1,
118 TYPE_POPUP = 2, 115 TYPE_POPUP = 2,
119 TYPE_PANEL = 3 116 TYPE_PANEL = 3
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 void SetWindowForTesting(BrowserWindow* window); 238 void SetWindowForTesting(BrowserWindow* window);
242 239
243 // Accessors //////////////////////////////////////////////////////////////// 240 // Accessors ////////////////////////////////////////////////////////////////
244 241
245 Type type() const { return type_; } 242 Type type() const { return type_; }
246 const std::string& app_name() const { return app_name_; } 243 const std::string& app_name() const { return app_name_; }
247 AppType app_type() const { return app_type_; } 244 AppType app_type() const { return app_type_; }
248 Profile* profile() const { return profile_; } 245 Profile* profile() const { return profile_; }
249 gfx::Rect override_bounds() const { return override_bounds_; } 246 gfx::Rect override_bounds() const { return override_bounds_; }
250 247
251 // Returns the InstantController or NULL if there is no InstantController for
252 // this Browser.
253 InstantController* instant() const { return instant_.get(); }
254
255 // |window()| will return NULL if called before |CreateBrowserWindow()| 248 // |window()| will return NULL if called before |CreateBrowserWindow()|
256 // is done. 249 // is done.
257 BrowserWindow* window() const { return window_; } 250 BrowserWindow* window() const { return window_; }
258 ToolbarModel* toolbar_model() { return toolbar_model_.get(); } 251 ToolbarModel* toolbar_model() { return toolbar_model_.get(); }
259 const ToolbarModel* toolbar_model() const { return toolbar_model_.get(); } 252 const ToolbarModel* toolbar_model() const { return toolbar_model_.get(); }
260 chrome::BrowserCommandController* command_controller() { 253 chrome::BrowserCommandController* command_controller() {
261 return command_controller_.get(); 254 return command_controller_.get();
262 } 255 }
263 chrome::search::SearchModel* search_model() { return search_model_.get(); } 256 chrome::search::SearchModel* search_model() { return search_model_.get(); }
264 const chrome::search::SearchModel* search_model() const { 257 const chrome::search::SearchModel* search_model() const {
265 return search_model_.get(); 258 return search_model_.get();
266 } 259 }
267 chrome::search::SearchDelegate* search_delegate() { 260 chrome::search::SearchDelegate* search_delegate() {
268 return search_delegate_.get(); 261 return search_delegate_.get();
269 } 262 }
270 const SessionID& session_id() const { return session_id_; } 263 const SessionID& session_id() const { return session_id_; }
271 BrowserContentSettingBubbleModelDelegate* 264 BrowserContentSettingBubbleModelDelegate*
272 content_setting_bubble_model_delegate() { 265 content_setting_bubble_model_delegate() {
273 return content_setting_bubble_model_delegate_.get(); 266 return content_setting_bubble_model_delegate_.get();
274 } 267 }
275 BrowserTabRestoreServiceDelegate* tab_restore_service_delegate() { 268 BrowserTabRestoreServiceDelegate* tab_restore_service_delegate() {
276 return tab_restore_service_delegate_.get(); 269 return tab_restore_service_delegate_.get();
277 } 270 }
278 BrowserSyncedWindowDelegate* synced_window_delegate() { 271 BrowserSyncedWindowDelegate* synced_window_delegate() {
279 return synced_window_delegate_.get(); 272 return synced_window_delegate_.get();
280 } 273 }
274 chrome::BrowserInstantController* instant_controller() {
275 return instant_controller_.get();
276 }
281 277
282 // Get the FindBarController for this browser, creating it if it does not 278 // Get the FindBarController for this browser, creating it if it does not
283 // yet exist. 279 // yet exist.
284 FindBarController* GetFindBarController(); 280 FindBarController* GetFindBarController();
285 281
286 // Returns true if a FindBarController exists for this browser. 282 // Returns true if a FindBarController exists for this browser.
287 bool HasFindBarController() const; 283 bool HasFindBarController() const;
288 284
289 // Returns the state of the bookmark bar. 285 // Returns the state of the bookmark bar.
290 BookmarkBar::State bookmark_bar_state() const { return bookmark_bar_state_; } 286 BookmarkBar::State bookmark_bar_state() const { return bookmark_bar_state_; }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 // TODO(port): port these, and re-merge the two function declaration lists. 370 // TODO(port): port these, and re-merge the two function declaration lists.
375 // Page-related commands. 371 // Page-related commands.
376 void ToggleEncodingAutoDetect(); 372 void ToggleEncodingAutoDetect();
377 void OverrideEncoding(int encoding_id); 373 void OverrideEncoding(int encoding_id);
378 374
379 // Show various bits of UI 375 // Show various bits of UI
380 void OpenFile(); 376 void OpenFile();
381 377
382 void UpdateDownloadShelfVisibility(bool visible); 378 void UpdateDownloadShelfVisibility(bool visible);
383 379
384 // Commits the current instant, returning true on success. This is intended
385 // for use from OpenCurrentURL.
386 bool OpenInstant(WindowOpenDisposition disposition);
387
388 ///////////////////////////////////////////////////////////////////////////// 380 /////////////////////////////////////////////////////////////////////////////
389 381
390 // Helper function to run unload listeners on a WebContents. 382 // Helper function to run unload listeners on a WebContents.
391 static bool RunUnloadEventsHelper(content::WebContents* contents); 383 static bool RunUnloadEventsHelper(content::WebContents* contents);
392 384
393 // Helper function to handle JS out of memory notifications 385 // Helper function to handle JS out of memory notifications
394 static void JSOutOfMemoryHelper(content::WebContents* web_contents); 386 static void JSOutOfMemoryHelper(content::WebContents* web_contents);
395 387
396 // Helper function to register a protocol handler. 388 // Helper function to register a protocol handler.
397 static void RegisterProtocolHandlerHelper(content::WebContents* web_contents, 389 static void RegisterProtocolHandlerHelper(content::WebContents* web_contents,
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 // Overridden from SelectFileDialog::Listener: 686 // Overridden from SelectFileDialog::Listener:
695 virtual void FileSelected(const FilePath& path, 687 virtual void FileSelected(const FilePath& path,
696 int index, 688 int index,
697 void* params) OVERRIDE; 689 void* params) OVERRIDE;
698 690
699 // Overridden from content::NotificationObserver: 691 // Overridden from content::NotificationObserver:
700 virtual void Observe(int type, 692 virtual void Observe(int type,
701 const content::NotificationSource& source, 693 const content::NotificationSource& source,
702 const content::NotificationDetails& details) OVERRIDE; 694 const content::NotificationDetails& details) OVERRIDE;
703 695
704 // Overriden from InstantControllerDelegate:
705 virtual void ShowInstant(TabContents* preview_contents) OVERRIDE;
706 virtual void HideInstant() OVERRIDE;
707 virtual void CommitInstant(TabContents* preview_contents) OVERRIDE;
708 virtual void SetSuggestedText(const string16& text,
709 InstantCompleteBehavior behavior) OVERRIDE;
710 virtual gfx::Rect GetInstantBounds() OVERRIDE;
711 virtual void InstantPreviewFocused() OVERRIDE;
712 virtual TabContents* GetInstantHostTabContents() const OVERRIDE;
713
714 // Command and state updating /////////////////////////////////////////////// 696 // Command and state updating ///////////////////////////////////////////////
715 697
716 // Set the preference that indicates that the home page has been changed. 698 // Set the preference that indicates that the home page has been changed.
717 void MarkHomePageAsChanged(PrefService* pref_service); 699 void MarkHomePageAsChanged(PrefService* pref_service);
718 700
719 // UI update coalescing and handling //////////////////////////////////////// 701 // UI update coalescing and handling ////////////////////////////////////////
720 702
721 // Asks the toolbar (and as such the location bar) to update its state to 703 // Asks the toolbar (and as such the location bar) to update its state to
722 // reflect the current tab's current URL, security state, etc. 704 // reflect the current tab's current URL, security state, etc.
723 // If |should_restore_state| is true, we're switching (back?) to this tab and 705 // If |should_restore_state| is true, we're switching (back?) to this tab and
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 content::WebContents* GetOrCloneTabForDisposition( 778 content::WebContents* GetOrCloneTabForDisposition(
797 WindowOpenDisposition disposition); 779 WindowOpenDisposition disposition);
798 780
799 // Implementation of SupportsWindowFeature and CanSupportWindowFeature. If 781 // Implementation of SupportsWindowFeature and CanSupportWindowFeature. If
800 // |check_fullscreen| is true, the set of features reflect the actual state of 782 // |check_fullscreen| is true, the set of features reflect the actual state of
801 // the browser, otherwise the set of features reflect the possible state of 783 // the browser, otherwise the set of features reflect the possible state of
802 // the browser. 784 // the browser.
803 bool SupportsWindowFeatureImpl(WindowFeature feature, 785 bool SupportsWindowFeatureImpl(WindowFeature feature,
804 bool check_fullscreen) const; 786 bool check_fullscreen) const;
805 787
806 // If this browser should have instant one is created, otherwise does nothing.
807 void CreateInstantIfNecessary();
808
809 // Resets |bookmark_bar_state_| based on the active tab. Notifies the 788 // Resets |bookmark_bar_state_| based on the active tab. Notifies the
810 // BrowserWindow if necessary. 789 // BrowserWindow if necessary.
811 void UpdateBookmarkBarState(BookmarkBarStateChangeReason reason); 790 void UpdateBookmarkBarState(BookmarkBarStateChangeReason reason);
812 791
813 // Creates a BackgroundContents if appropriate; return true if one was 792 // Creates a BackgroundContents if appropriate; return true if one was
814 // created. 793 // created.
815 bool MaybeCreateBackgroundContents(int route_id, 794 bool MaybeCreateBackgroundContents(int route_id,
816 content::WebContents* opener_web_contents, 795 content::WebContents* opener_web_contents,
817 const string16& frame_name, 796 const string16& frame_name,
818 const GURL& target_url); 797 const GURL& target_url);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 // A delegate that handles the details of updating the "active" 903 // A delegate that handles the details of updating the "active"
925 // |search_model_| state with the tab's state. 904 // |search_model_| state with the tab's state.
926 scoped_ptr<chrome::search::SearchDelegate> search_delegate_; 905 scoped_ptr<chrome::search::SearchDelegate> search_delegate_;
927 906
928 // Helper which implements the TabRestoreServiceDelegate interface. 907 // Helper which implements the TabRestoreServiceDelegate interface.
929 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; 908 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_;
930 909
931 // Helper which implements the SyncedWindowDelegate interface. 910 // Helper which implements the SyncedWindowDelegate interface.
932 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; 911 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_;
933 912
934 scoped_ptr<InstantController> instant_; 913 scoped_ptr<chrome::BrowserInstantController> instant_controller_;
935 scoped_ptr<InstantUnloadHandler> instant_unload_handler_;
936 914
937 BookmarkBar::State bookmark_bar_state_; 915 BookmarkBar::State bookmark_bar_state_;
938 DeviceAttachedIntentSource device_attached_intent_source_; 916 DeviceAttachedIntentSource device_attached_intent_source_;
939 917
940 scoped_refptr<FullscreenController> fullscreen_controller_; 918 scoped_refptr<FullscreenController> fullscreen_controller_;
941 919
942 scoped_ptr<ExtensionWindowController> extension_window_controller_; 920 scoped_ptr<ExtensionWindowController> extension_window_controller_;
943 921
944 scoped_ptr<chrome::BrowserCommandController> command_controller_; 922 scoped_ptr<chrome::BrowserCommandController> command_controller_;
945 923
946 // True if the browser window has been shown at least once. 924 // True if the browser window has been shown at least once.
947 bool window_has_shown_; 925 bool window_has_shown_;
948 926
949 // Currently open color chooser. Non-NULL after OpenColorChooser is called and 927 // Currently open color chooser. Non-NULL after OpenColorChooser is called and
950 // before DidEndColorChooser is called. 928 // before DidEndColorChooser is called.
951 scoped_ptr<content::ColorChooser> color_chooser_; 929 scoped_ptr<content::ColorChooser> color_chooser_;
952 930
953 DISALLOW_COPY_AND_ASSIGN(Browser); 931 DISALLOW_COPY_AND_ASSIGN(Browser);
954 }; 932 };
955 933
956 #endif // CHROME_BROWSER_UI_BROWSER_H_ 934 #endif // CHROME_BROWSER_UI_BROWSER_H_
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/task_manager_resource_providers.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698