1// Copyright (c) 2011 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_UI_BROWSER_H_
6#define CHROME_BROWSER_UI_BROWSER_H_
7#pragma once
8
9#include <map>
10#include <set>
11#include <string>
12#include <vector>
13
14#include "base/basictypes.h"
15#include "base/compiler_specific.h"
16#include "base/gtest_prod_util.h"
17#include "base/memory/scoped_ptr.h"
18#include "base/string16.h"
19#include "base/task.h"
20#include "chrome/browser/command_updater.h"
21#include "chrome/browser/debugger/devtools_toggle_action.h"
22#include "chrome/browser/instant/instant_delegate.h"
23#include "chrome/browser/prefs/pref_member.h"
24#include "chrome/browser/sessions/session_id.h"
25#include "chrome/browser/sessions/tab_restore_service_observer.h"
26#include "chrome/browser/sync/profile_sync_service_observer.h"
27#include "chrome/browser/tabs/tab_handler.h"
28#include "chrome/browser/tabs/tab_strip_model_delegate.h"  // TODO(beng): remove
29#include "chrome/browser/tabs/tab_strip_model_observer.h"  // TODO(beng): remove
30#include "chrome/browser/ui/browser_navigator.h"
31#include "chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h"
32#include "chrome/browser/ui/shell_dialogs.h"
33#include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h"
34#include "chrome/browser/ui/toolbar/toolbar_model.h"
35#include "chrome/common/extensions/extension_constants.h"
36#include "content/browser/tab_contents/page_navigator.h"
37#include "content/browser/tab_contents/tab_contents_delegate.h"
38#include "content/common/notification_registrar.h"
39#include "content/common/page_transition_types.h"
40#include "content/common/page_zoom.h"
41#include "ui/gfx/rect.h"
42
43class BrowserTabRestoreServiceDelegate;
44class BrowserWindow;
45class Extension;
46class FindBarController;
47class InstantController;
48class InstantUnloadHandler;
49class PrefService;
50class Profile;
51class SessionStorageNamespace;
52class SkBitmap;
53class StatusBubble;
54class TabNavigation;
55class TabStripModel;
56struct WebApplicationInfo;
57namespace gfx {
58class Point;
59}
60
61class Browser : public TabHandlerDelegate,
62                public TabContentsDelegate,
63                public TabContentsWrapperDelegate,
64                public SearchEngineTabHelperDelegate,
65                public PageNavigator,
66                public CommandUpdater::CommandUpdaterDelegate,
67                public NotificationObserver,
68                public SelectFileDialog::Listener,
69                public TabRestoreServiceObserver,
70                public ProfileSyncServiceObserver,
71                public InstantDelegate {
72 public:
73  // SessionService::WindowType mirrors these values.  If you add to this
74  // enum, look at SessionService::WindowType to see if it needs to be
75  // updated.
76  enum Type {
77    TYPE_NORMAL = 1,
78    TYPE_POPUP = 2,
79    // The old-style app created via "Create application shortcuts".
80    // Shortcuts to a URL and shortcuts to an installed application
81    // both have this type.
82    TYPE_APP = 4,
83    TYPE_APP_POPUP = TYPE_APP | TYPE_POPUP,
84    TYPE_DEVTOOLS = TYPE_APP | 8,
85
86    // TODO(skerner): crbug/56776: Until the panel UI is complete on all
87    // platforms, apps that set app.launch.container = "panel" have type
88    // APP_POPUP. (see Browser::CreateForApp)
89    // NOTE: TYPE_APP_PANEL is a superset of TYPE_APP_POPUP.
90    TYPE_APP_PANEL = TYPE_APP | TYPE_POPUP | 16,
91    TYPE_ANY = TYPE_NORMAL |
92               TYPE_POPUP |
93               TYPE_APP |
94               TYPE_DEVTOOLS |
95               TYPE_APP_PANEL
96  };
97
98  // Possible elements of the Browser window.
99  enum WindowFeature {
100    FEATURE_NONE = 0,
101    FEATURE_TITLEBAR = 1,
102    FEATURE_TABSTRIP = 2,
103    FEATURE_TOOLBAR = 4,
104    FEATURE_LOCATIONBAR = 8,
105    FEATURE_BOOKMARKBAR = 16,
106    FEATURE_INFOBAR = 32,
107    FEATURE_SIDEBAR = 64,
108    FEATURE_DOWNLOADSHELF = 128
109  };
110
111  // Maximized state on creation.
112  enum MaximizedState {
113    // The maximized state is set to the default, which varies depending upon
114    // what the user has done.
115    MAXIMIZED_STATE_DEFAULT,
116
117    // Maximized state is explicitly maximized.
118    MAXIMIZED_STATE_MAXIMIZED,
119
120    // Maximized state is explicitly not maximized (normal).
121    MAXIMIZED_STATE_UNMAXIMIZED
122  };
123
124  // Constructors, Creation, Showing //////////////////////////////////////////
125
126  // Creates a new browser of the given |type| and for the given |profile|. The
127  // Browser has a NULL window after its construction, InitBrowserWindow must
128  // be called after configuration for window() to be valid.
129  // Avoid using this constructor directly if you can use one of the Create*()
130  // methods below. This applies to almost all non-testing code.
131  Browser(Type type, Profile* profile);
132  virtual ~Browser();
133
134  // Creates a normal tabbed browser with the specified profile. The Browser's
135  // window is created by this function call.
136  static Browser* Create(Profile* profile);
137
138  // Like Create, but creates a browser of the specified (popup) type, with the
139  // specified contents, in a popup window of the specified size/position.
140  static Browser* CreateForPopup(Type type, Profile* profile,
141                                 TabContents* new_contents,
142                                 const gfx::Rect& initial_bounds);
143
144  // Like Create, but creates a browser of the specified type.
145  static Browser* CreateForType(Type type, Profile* profile);
146
147  // Like Create, but creates a toolbar-less "app" window for the specified
148  // app. |app_name| is required and is used to identify the window to the
149  // shell.  If |extension| is set, it is used to determine the size of the
150  // window to open.
151  static Browser* CreateForApp(const std::string& app_name,
152                               const gfx::Size& window_size,
153                               Profile* profile,
154                               bool is_panel);
155
156  // Like Create, but creates a tabstrip-less and toolbar-less
157  // DevTools "app" window.
158  static Browser* CreateForDevTools(Profile* profile);
159
160  // Set overrides for the initial window bounds and maximized state.
161  void set_override_bounds(const gfx::Rect& bounds) {
162    override_bounds_ = bounds;
163  }
164  void set_maximized_state(MaximizedState state) {
165    maximized_state_ = state;
166  }
167  // Return true if the initial window bounds have been overridden.
168  bool bounds_overridden() const {
169    return !override_bounds_.IsEmpty();
170  }
171
172  // Creates the Browser Window. Prefer to use the static helpers above where
173  // possible. This does not show the window. You need to call window()->Show()
174  // to show it.
175  void InitBrowserWindow();
176
177  // Accessors ////////////////////////////////////////////////////////////////
178
179  Type type() const { return type_; }
180  const std::string& app_name() const { return app_name_; }
181  Profile* profile() const { return profile_; }
182  const std::vector<std::wstring>& user_data_dir_profiles() const;
183  gfx::Rect override_bounds() const { return override_bounds_; }
184
185  // Returns the InstantController or NULL if there is no InstantController for
186  // this Browser.
187  InstantController* instant() const { return instant_.get(); }
188
189#if defined(UNIT_TEST)
190  // Sets the BrowserWindow. This is intended for testing and generally not
191  // useful outside of testing. Use CreateBrowserWindow outside of testing, or
192  // the static convenience methods that create a BrowserWindow for you.
193  void set_window(BrowserWindow* window) {
194    DCHECK(!window_);
195    window_ = window;
196  }
197#endif
198
199  // |window()| will return NULL if called before |CreateBrowserWindow()|
200  // is done.
201  BrowserWindow* window() const { return window_; }
202  ToolbarModel* toolbar_model() { return &toolbar_model_; }
203  const SessionID& session_id() const { return session_id_; }
204  CommandUpdater* command_updater() { return &command_updater_; }
205  bool block_command_execution() const { return block_command_execution_; }
206  BrowserTabRestoreServiceDelegate* tab_restore_service_delegate() {
207    return tab_restore_service_delegate_.get();
208  }
209
210  // Get the FindBarController for this browser, creating it if it does not
211  // yet exist.
212  FindBarController* GetFindBarController();
213
214  // Returns true if a FindBarController exists for this browser.
215  bool HasFindBarController() const;
216
217  // Setters /////////////////////////////////////////////////////////////////
218
219  void set_user_data_dir_profiles(const std::vector<std::wstring>& profiles);
220
221  // Browser Creation Helpers /////////////////////////////////////////////////
222
223  // Opens a new window with the default blank tab.
224  static void OpenEmptyWindow(Profile* profile);
225
226  // Opens a new window with the tabs from |profile|'s TabRestoreService.
227  static void OpenWindowWithRestoredTabs(Profile* profile);
228
229  // Opens the specified URL in a new browser window in an incognito session.
230  // If there is already an existing active incognito session for the specified
231  // |profile|, that session is re-used.
232  static void OpenURLOffTheRecord(Profile* profile, const GURL& url);
233
234  // Open |extension| in |container|, using |existing_tab| if not NULL and if
235  // the correct container type.  Returns the TabContents* that was created or
236  // NULL.
237  static TabContents* OpenApplication(
238      Profile* profile,
239      const Extension* extension,
240      extension_misc::LaunchContainer container,
241      TabContents* existing_tab);
242
243  // Opens a new application window for the specified url. If |as_panel|
244  // is true, the application will be opened as a Browser::Type::APP_PANEL in
245  // app panel window, otherwise it will be opened as as either
246  // Browser::Type::APP a.k.a. "thin frame" (if |extension| is NULL) or
247  // Browser::Type::EXTENSION_APP (if |extension| is non-NULL).
248  // If |app_browser| is not NULL, it is set to the browser that hosts the
249  // returned tab.
250  static TabContents* OpenApplicationWindow(
251      Profile* profile,
252      const Extension* extension,
253      extension_misc::LaunchContainer container,
254      const GURL& url,
255      Browser** app_browser);
256
257  // Open |url| in an app shortcut window.  If |update_shortcut| is true,
258  // update the name, description, and favicon of the shortcut.
259  // There are two kinds of app shortcuts: Shortcuts to a URL,
260  // and shortcuts that open an installed application.  This function
261  // is used to open the former.  To open the latter, use
262  // Browser::OpenApplicationWindow().
263  static TabContents* OpenAppShortcutWindow(Profile* profile,
264                                            const GURL& url,
265                                            bool update_shortcut);
266
267  // Open an application for |extension| in a new application tab, or
268  // |existing_tab| if not NULL.  Returns NULL if there are no appropriate
269  // existing browser windows for |profile|.
270  static TabContents* OpenApplicationTab(Profile* profile,
271                                         const Extension* extension,
272                                         TabContents* existing_tab);
273
274  // Opens a new window and opens the bookmark manager.
275  static void OpenBookmarkManagerWindow(Profile* profile);
276
277#if defined(OS_MACOSX)
278  // Open a new window with history/downloads/help/options (needed on Mac when
279  // there are no windows).
280  static void OpenHistoryWindow(Profile* profile);
281  static void OpenDownloadsWindow(Profile* profile);
282  static void OpenHelpWindow(Profile* profile);
283  static void OpenOptionsWindow(Profile* profile);
284  static void OpenClearBrowingDataDialogWindow(Profile* profile);
285  static void OpenImportSettingsDialogWindow(Profile* profile);
286  static void OpenInstantConfirmDialogWindow(Profile* profile);
287#endif
288
289  // Opens a window with the extensions tab in it - needed by long-lived
290  // extensions which may run with no windows open.
291  static void OpenExtensionsWindow(Profile* profile);
292
293  // State Storage and Retrieval for UI ///////////////////////////////////////
294
295  // Save and restore the window position.
296  std::string GetWindowPlacementKey() const;
297  bool ShouldSaveWindowPlacement() const;
298  void SaveWindowPlacement(const gfx::Rect& bounds, bool maximized);
299  gfx::Rect GetSavedWindowBounds() const;
300  bool GetSavedMaximizedState() const;
301
302  // Gets the Favicon of the page in the selected tab.
303  SkBitmap GetCurrentPageIcon() const;
304
305  // Gets the title of the window based on the selected tab's title.
306  string16 GetWindowTitleForCurrentTab() const;
307
308  // Prepares a title string for display (removes embedded newlines, etc).
309  static void FormatTitleForDisplay(string16* title);
310
311  // OnBeforeUnload handling //////////////////////////////////////////////////
312
313  // Gives beforeunload handlers the chance to cancel the close.
314  bool ShouldCloseWindow();
315
316  bool IsAttemptingToCloseBrowser() const {
317    return is_attempting_to_close_browser_;
318  }
319
320  // Invoked when the window containing us is closing. Performs the necessary
321  // cleanup.
322  void OnWindowClosing();
323
324  // In-progress download termination handling /////////////////////////////////
325
326  // Are normal and/or incognito downloads in progress?
327  void CheckDownloadsInProgress(bool* normal_downloads,
328                                bool* incognito_downloads);
329
330  // Called when the user has decided whether to proceed or not with the browser
331  // closure.  |cancel_downloads| is true if the downloads should be canceled
332  // and the browser closed, false if the browser should stay open and the
333  // downloads running.
334  void InProgressDownloadResponse(bool cancel_downloads);
335
336  // TabStripModel pass-thrus /////////////////////////////////////////////////
337
338  TabStripModel* tabstrip_model() const {
339    // TODO(beng): remove this accessor. It violates google style.
340    return tab_handler_->GetTabStripModel();
341  }
342
343  int tab_count() const;
344  int active_index() const;
345  int GetIndexOfController(const NavigationController* controller) const;
346  TabContentsWrapper* GetSelectedTabContentsWrapper() const;
347  TabContentsWrapper* GetTabContentsWrapperAt(int index) const;
348  // Same as above but correctly handles if GetSelectedTabContents() is NULL
349  // in the model before dereferencing to get the raw TabContents.
350  // TODO(pinkerton): These should really be returning TabContentsWrapper
351  // objects, but that would require changing about 50+ other files. In order
352  // to keep changes localized, the default is to return a TabContents. Note
353  // this differs from the TabStripModel because it has far fewer clients.
354  TabContents* GetSelectedTabContents() const;
355  TabContents* GetTabContentsAt(int index) const;
356  void ActivateTabAt(int index, bool user_gesture);
357  bool IsTabPinned(int index) const;
358  void CloseAllTabs();
359
360  // Tab adding/showing functions /////////////////////////////////////////////
361
362  // Returns true if the tab strip is editable (for extensions).
363  bool IsTabStripEditable() const;
364
365  // Returns the index to insert a tab at during session restore and startup.
366  // |relative_index| gives the index of the url into the number of tabs that
367  // are going to be opened. For example, if three urls are passed in on the
368  // command line this is invoked three times with the values 0, 1 and 2.
369  int GetIndexForInsertionDuringRestore(int relative_index);
370
371  // Adds a selected tab with the specified URL and transition, returns the
372  // created TabContents.
373  TabContentsWrapper* AddSelectedTabWithURL(
374      const GURL& url,
375      PageTransition::Type transition);
376
377  // Add a new tab, given a TabContents. A TabContents appropriate to
378  // display the last committed entry is created and returned.
379  TabContents* AddTab(TabContentsWrapper* tab_contents,
380                      PageTransition::Type type);
381
382  // Add a tab with its session history restored from the SessionRestore
383  // system. If select is true, the tab is selected. |tab_index| gives the index
384  // to insert the tab at. |selected_navigation| is the index of the
385  // TabNavigation in |navigations| to select. If |extension_app_id| is
386  // non-empty the tab is an app tab and |extension_app_id| is the id of the
387  // extension. If |pin| is true and |tab_index|/ is the last pinned tab, then
388  // the newly created tab is pinned. If |from_last_session| is true,
389  // |navigations| are from the previous session.
390  TabContents* AddRestoredTab(const std::vector<TabNavigation>& navigations,
391                              int tab_index,
392                              int selected_navigation,
393                              const std::string& extension_app_id,
394                              bool select,
395                              bool pin,
396                              bool from_last_session,
397                              SessionStorageNamespace* storage_namespace);
398  // Creates a new tab with the already-created TabContents 'new_contents'.
399  // The window for the added contents will be reparented correctly when this
400  // method returns.  If |disposition| is NEW_POPUP, |pos| should hold the
401  // initial position.
402  void AddTabContents(TabContents* new_contents,
403                      WindowOpenDisposition disposition,
404                      const gfx::Rect& initial_pos,
405                      bool user_gesture);
406  void CloseTabContents(TabContents* contents);
407
408  // Show a dialog with HTML content. |delegate| contains a pointer to the
409  // delegate who knows how to display the dialog (which file URL and JSON
410  // string input to use during initialization). |parent_window| is the window
411  // that should be parent of the dialog, or NULL for the default.
412  void BrowserShowHtmlDialog(HtmlDialogUIDelegate* delegate,
413                             gfx::NativeWindow parent_window);
414
415  // Called when a popup select is about to be displayed.
416  void BrowserRenderWidgetShowing();
417
418  // Notification that the bookmark bar has changed size.  We need to resize the
419  // content area and notify our InfoBarContainer.
420  void BookmarkBarSizeChanged(bool is_animating);
421
422  // Replaces the state of the currently selected tab with the session
423  // history restored from the SessionRestore system.
424  void ReplaceRestoredTab(
425      const std::vector<TabNavigation>& navigations,
426      int selected_navigation,
427      bool from_last_session,
428      const std::string& extension_app_id,
429      SessionStorageNamespace* session_storage_namespace);
430
431  // Navigate to an index in the tab history, opening a new tab depending on the
432  // disposition.
433  bool NavigateToIndexWithDisposition(int index, WindowOpenDisposition disp);
434
435  // Show a given a URL. If a tab with the same URL (ignoring the ref) is
436  // already visible in this browser, it becomes selected. Otherwise a new tab
437  // is created.
438  void ShowSingletonTab(const GURL& url);
439
440  // Update commands whose state depends on whether the window is in fullscreen
441  // mode. This is a public function because on Linux, fullscreen mode is an
442  // async call to X. Once we get the fullscreen callback, the browser window
443  // will call this method.
444  void UpdateCommandsForFullscreenMode(bool is_fullscreen);
445
446  // Assorted browser commands ////////////////////////////////////////////////
447
448  // NOTE: Within each of the following sections, the IDs are ordered roughly by
449  // how they appear in the GUI/menus (left to right, top to bottom, etc.).
450
451  // Navigation commands
452  void GoBack(WindowOpenDisposition disposition);
453  void GoForward(WindowOpenDisposition disposition);
454  void Reload(WindowOpenDisposition disposition);
455  void ReloadIgnoringCache(WindowOpenDisposition disposition);  // Shift-reload.
456  void Home(WindowOpenDisposition disposition);
457  void OpenCurrentURL();
458  void Stop();
459  // Window management commands
460  void NewWindow();
461  void NewIncognitoWindow();
462  void CloseWindow();
463  void NewTab();
464  void CloseTab();
465  void SelectNextTab();
466  void SelectPreviousTab();
467  void OpenTabpose();
468  void MoveTabNext();
469  void MoveTabPrevious();
470  void SelectNumberedTab(int index);
471  void SelectLastTab();
472  void DuplicateTab();
473  void WriteCurrentURLToClipboard();
474  void ConvertPopupToTabbedBrowser();
475  // In kiosk mode, the first toggle is valid, the rest is discarded.
476  void ToggleFullscreenMode();
477  void Exit();
478#if defined(OS_CHROMEOS)
479  void ToggleCompactNavigationBar();
480  void Search();
481  void ShowKeyboardOverlay();
482#endif
483
484  // Page-related commands
485  void BookmarkCurrentPage();
486  void SavePage();
487  void ViewSelectedSource();
488  void ShowFindBar();
489
490  // Returns true if the Browser supports the specified feature. The value of
491  // this varies during the lifetime of the browser. For example, if the window
492  // is fullscreen this may return a different value. If you only care about
493  // whether or not it's possible for the browser to support a particular
494  // feature use |CanSupportWindowFeature|.
495  bool SupportsWindowFeature(WindowFeature feature) const;
496
497  // Returns true if the Browser can support the specified feature. See comment
498  // in |SupportsWindowFeature| for details on this.
499  bool CanSupportWindowFeature(WindowFeature feature) const;
500
501  // TODO(port): port these, and re-merge the two function declaration lists.
502  // Page-related commands.
503  void Print();
504  void EmailPageLocation();
505  void ToggleEncodingAutoDetect();
506  void OverrideEncoding(int encoding_id);
507
508  // Clipboard commands
509  void Cut();
510  void Copy();
511  void Paste();
512
513  // Find-in-page
514  void Find();
515  void FindNext();
516  void FindPrevious();
517
518  // Zoom
519  void Zoom(PageZoom::Function zoom_function);
520
521  // Focus various bits of UI
522  void FocusToolbar();
523  void FocusLocationBar();  // Also selects any existing text.
524  void FocusSearch();
525  void FocusAppMenu();
526  void FocusBookmarksToolbar();
527  void FocusChromeOSStatus();
528  void FocusNextPane();
529  void FocusPreviousPane();
530
531  // Show various bits of UI
532  void OpenFile();
533  void OpenCreateShortcutsDialog();
534  void ToggleDevToolsWindow(DevToolsToggleAction action);
535  void OpenTaskManager(bool highlight_background_resources);
536  void OpenBugReportDialog();
537
538  void ToggleBookmarkBar();
539
540  void OpenBookmarkManager();
541  void ShowAppMenu();
542  void ShowBookmarkManagerTab();
543  void ShowHistoryTab();
544  void ShowDownloadsTab();
545  void ShowExtensionsTab();
546  void ShowAboutConflictsTab();
547  void ShowBrokenPageTab(TabContents* contents);
548  void ShowOptionsTab(const std::string& sub_page);
549  void OpenClearBrowsingDataDialog();
550  void OpenOptionsDialog();
551  void OpenPasswordManager();
552  void OpenSyncMyBookmarksDialog();
553#if defined(ENABLE_REMOTING)
554  void OpenRemotingSetupDialog();
555#endif
556  void OpenImportSettingsDialog();
557  void OpenInstantConfirmDialog();
558  void OpenAboutChromeDialog();
559  void OpenUpdateChromeDialog();
560  void OpenHelpTab();
561  // Used by the "Get themes" link in the options dialog.
562  void OpenThemeGalleryTabAndActivate();
563  void OpenAutofillHelpTabAndActivate();
564  void OpenPrivacyDashboardTabAndActivate();
565  void OpenSearchEngineOptionsDialog();
566#if defined(OS_CHROMEOS)
567  void OpenFileManager();
568  void OpenSystemOptionsDialog();
569  void OpenInternetOptionsDialog();
570  void OpenLanguageOptionsDialog();
571  void OpenSystemTabAndActivate();
572  void OpenMobilePlanTabAndActivate();
573#endif
574  void OpenPluginsTabAndActivate();
575
576  virtual void UpdateDownloadShelfVisibility(bool visible);
577
578  // Overridden from TabStripModelDelegate:
579  virtual bool UseVerticalTabs() const;
580
581  /////////////////////////////////////////////////////////////////////////////
582
583  // Sets the value of homepage related prefs to new values. Since we do not
584  // want to change these values for existing users, we can not change the
585  // default values under RegisterUserPrefs. Also if user already has an
586  // existing profile we do not want to override those preferences so we only
587  // set new values if they have not been set already. This method gets called
588  // during First Run.
589  static void SetNewHomePagePrefs(PrefService* prefs);
590
591  static void RegisterPrefs(PrefService* prefs);
592  static void RegisterUserPrefs(PrefService* prefs);
593
594  // Helper function to run unload listeners on a TabContents.
595  static bool RunUnloadEventsHelper(TabContents* contents);
596
597  // Returns the Browser which contains the tab with the given
598  // NavigationController, also filling in |index| (if valid) with the tab's
599  // index in the tab strip.
600  // Returns NULL if not found.
601  // This call is O(N) in the number of tabs.
602  static Browser* GetBrowserForController(
603      const NavigationController* controller, int* index);
604
605  // Retrieve the last active tabbed browser with a profile matching |profile|.
606  static Browser* GetTabbedBrowser(Profile* profile, bool match_incognito);
607
608  // Retrieve the last active tabbed browser with a profile matching |profile|.
609  // Creates a new Browser if none are available.
610  static Browser* GetOrCreateTabbedBrowser(Profile* profile);
611
612  // Calls ExecuteCommandWithDisposition with the given disposition.
613  void ExecuteCommandWithDisposition(int id, WindowOpenDisposition);
614
615  // Executes a command if it's enabled.
616  // Returns true if the command is executed.
617  bool ExecuteCommandIfEnabled(int id);
618
619  // Returns true if |command_id| is a reserved command whose keyboard shortcuts
620  // should not be sent to the renderer or |event| was triggered by a key that
621  // we never want to send to the renderer.
622  bool IsReservedCommandOrKey(int command_id,
623                              const NativeWebKeyboardEvent& event);
624
625  // Sets if command execution shall be blocked. If |block| is true then
626  // following calls to ExecuteCommand() or ExecuteCommandWithDisposition()
627  // method will not execute the command, and the last blocked command will be
628  // recorded for retrieval.
629  void SetBlockCommandExecution(bool block);
630
631  // Gets the last blocked command after calling SetBlockCommandExecution(true).
632  // Returns the command id or -1 if there is no command blocked. The
633  // disposition type of the command will be stored in |*disposition| if it's
634  // not null.
635  int GetLastBlockedCommand(WindowOpenDisposition* disposition);
636
637  // Called by browser::Navigate() when a navigation has occurred in a tab in
638  // this Browser. Updates the UI for the start of this navigation.
639  void UpdateUIForNavigationInTab(TabContentsWrapper* contents,
640                                  PageTransition::Type transition,
641                                  bool user_initiated);
642
643  // Called by browser::Navigate() to retrieve the home page if no URL is
644  // specified.
645  GURL GetHomePage() const;
646
647  // Interface implementations ////////////////////////////////////////////////
648
649  // Overridden from PageNavigator:
650  virtual void OpenURL(const GURL& url, const GURL& referrer,
651                       WindowOpenDisposition disposition,
652                       PageTransition::Type transition);
653
654  // Overridden from CommandUpdater::CommandUpdaterDelegate:
655  virtual void ExecuteCommand(int id);
656
657  // Overridden from TabRestoreServiceObserver:
658  virtual void TabRestoreServiceChanged(TabRestoreService* service);
659  virtual void TabRestoreServiceDestroyed(TabRestoreService* service);
660
661  // Centralized method for creating a TabContents, configuring and installing
662  // all its supporting objects and observers.
663  static TabContentsWrapper*
664      TabContentsFactory(Profile* profile,
665                         SiteInstance* site_instance,
666                         int routing_id,
667                         const TabContents* base_tab_contents,
668                         SessionStorageNamespace* session_storage_namespace);
669
670  // Overridden from TabHandlerDelegate:
671  virtual Profile* GetProfile() const;
672  virtual Browser* AsBrowser();
673
674  // Overridden from TabStripModelDelegate:
675  virtual TabContentsWrapper* AddBlankTab(bool foreground);
676  virtual TabContentsWrapper* AddBlankTabAt(int index, bool foreground);
677  virtual Browser* CreateNewStripWithContents(
678      TabContentsWrapper* detached_contents,
679      const gfx::Rect& window_bounds,
680      const DockInfo& dock_info,
681      bool maximize);
682  virtual int GetDragActions() const;
683  // Construct a TabContents for a given URL, profile and transition type.
684  // If instance is not null, its process will be used to render the tab.
685  virtual TabContentsWrapper* CreateTabContentsForURL(const GURL& url,
686                                               const GURL& referrer,
687                                               Profile* profile,
688                                               PageTransition::Type transition,
689                                               bool defer_load,
690                                               SiteInstance* instance) const;
691  virtual bool CanDuplicateContentsAt(int index);
692  virtual void DuplicateContentsAt(int index);
693  virtual void CloseFrameAfterDragSession();
694  virtual void CreateHistoricalTab(TabContentsWrapper* contents);
695  virtual bool RunUnloadListenerBeforeClosing(TabContentsWrapper* contents);
696  virtual bool CanCloseContentsAt(int index);
697  virtual bool CanBookmarkAllTabs() const;
698  virtual void BookmarkAllTabs();
699  virtual bool CanCloseTab() const;
700  virtual void ToggleUseVerticalTabs();
701  virtual bool CanRestoreTab();
702  virtual void RestoreTab();
703  virtual bool LargeIconsPermitted() const;
704
705  // Overridden from TabStripModelObserver:
706  virtual void TabInsertedAt(TabContentsWrapper* contents,
707                             int index,
708                             bool foreground);
709  virtual void TabClosingAt(TabStripModel* tab_strip_model,
710                            TabContentsWrapper* contents,
711                            int index);
712  virtual void TabDetachedAt(TabContentsWrapper* contents, int index);
713  virtual void TabDeselected(TabContentsWrapper* contents);
714  virtual void TabSelectedAt(TabContentsWrapper* old_contents,
715                             TabContentsWrapper* new_contents,
716                             int index,
717                             bool user_gesture);
718  virtual void TabMoved(TabContentsWrapper* contents,
719                        int from_index,
720                        int to_index);
721  virtual void TabReplacedAt(TabStripModel* tab_strip_model,
722                             TabContentsWrapper* old_contents,
723                             TabContentsWrapper* new_contents,
724                             int index);
725  virtual void TabPinnedStateChanged(TabContentsWrapper* contents, int index);
726  virtual void TabStripEmpty();
727
728  // Figure out if there are tabs that have beforeunload handlers.
729  bool TabsNeedBeforeUnloadFired();
730
731 protected:
732  // Wrapper for the factory method in BrowserWindow. This allows subclasses to
733  // set their own window.
734  virtual BrowserWindow* CreateBrowserWindow();
735
736 private:
737  FRIEND_TEST_ALL_PREFIXES(BrowserTest, NoTabsInPopups);
738  FRIEND_TEST_ALL_PREFIXES(BrowserTest, ConvertTabToAppShortcut);
739  FRIEND_TEST_ALL_PREFIXES(BrowserTest, OpenAppWindowLikeNtp);
740  FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch);
741  FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutNoPref);
742  FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutWindowPref);
743  FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutTabPref);
744  FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutPanel);
745
746  // Used to describe why a tab is being detached. This is used by
747  // TabDetachedAtImpl.
748  enum DetachType {
749    // Result of TabDetachedAt.
750    DETACH_TYPE_DETACH,
751
752    // Result of TabReplacedAt.
753    DETACH_TYPE_REPLACE,
754
755    // Result of the tab strip not having any significant tabs.
756    DETACH_TYPE_EMPTY
757  };
758
759  // Overridden from TabContentsDelegate:
760  virtual void OpenURLFromTab(TabContents* source,
761                              const GURL& url,
762                              const GURL& referrer,
763                              WindowOpenDisposition disposition,
764                              PageTransition::Type transition);
765  virtual void NavigationStateChanged(const TabContents* source,
766                                      unsigned changed_flags);
767  virtual void AddNewContents(TabContents* source,
768                              TabContents* new_contents,
769                              WindowOpenDisposition disposition,
770                              const gfx::Rect& initial_pos,
771                              bool user_gesture);
772  virtual void ActivateContents(TabContents* contents);
773  virtual void DeactivateContents(TabContents* contents);
774  virtual void LoadingStateChanged(TabContents* source);
775  virtual void CloseContents(TabContents* source);
776  virtual void MoveContents(TabContents* source, const gfx::Rect& pos);
777  virtual void DetachContents(TabContents* source);
778  virtual bool IsPopup(const TabContents* source) const;
779  virtual bool CanReloadContents(TabContents* source) const;
780  virtual void UpdateTargetURL(TabContents* source, const GURL& url);
781  virtual void ContentsMouseEvent(
782      TabContents* source, const gfx::Point& location, bool motion);
783  virtual void ContentsZoomChange(bool zoom_in);
784  virtual void OnContentSettingsChange(TabContents* source);
785  virtual void SetTabContentBlocked(TabContents* contents, bool blocked);
786  virtual void TabContentsFocused(TabContents* tab_content);
787  virtual bool TakeFocus(bool reverse);
788  virtual bool IsApplication() const;
789  virtual void ConvertContentsToApplication(TabContents* source);
790  virtual bool ShouldDisplayURLField();
791  virtual void ShowHtmlDialog(HtmlDialogUIDelegate* delegate,
792                              gfx::NativeWindow parent_window);
793  virtual void BeforeUnloadFired(TabContents* source,
794                                 bool proceed,
795                                 bool* proceed_to_fire_unload);
796  virtual void SetFocusToLocationBar(bool select_all);
797  virtual void RenderWidgetShowing();
798  virtual int GetExtraRenderViewHeight() const;
799  virtual void OnStartDownload(DownloadItem* download, TabContents* tab);
800  virtual void ShowPageInfo(Profile* profile,
801                            const GURL& url,
802                            const NavigationEntry::SSLStatus& ssl,
803                            bool show_history);
804  virtual void ViewSourceForTab(TabContents* source, const GURL& page_url);
805  virtual void ViewSourceForFrame(TabContents* source,
806                                  const GURL& frame_url,
807                                  const std::string& frame_content_state);
808  virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
809                                        bool* is_keyboard_shortcut);
810  virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event);
811  virtual void ShowRepostFormWarningDialog(TabContents* tab_contents);
812  virtual void ShowContentSettingsPage(ContentSettingsType content_type);
813  virtual void ShowCollectedCookiesDialog(TabContents* tab_contents);
814  virtual bool ShouldAddNavigationToHistory(
815      const history::HistoryAddPageArgs& add_page_args,
816      NavigationType::Type navigation_type);
817  virtual void ContentRestrictionsChanged(TabContents* source);
818  virtual void WorkerCrashed();
819
820  // Overridden from TabContentsWrapperDelegate:
821  virtual void URLStarredChanged(TabContentsWrapper* source,
822                                 bool starred) OVERRIDE;
823  virtual void OnDidGetApplicationInfo(TabContentsWrapper* source,
824                                       int32 page_id) OVERRIDE;
825  virtual void OnInstallApplication(
826      TabContentsWrapper* source,
827      const WebApplicationInfo& app_info) OVERRIDE;
828
829  // Overridden from SearchEngineTabHelperDelegate:
830  virtual void ConfirmSetDefaultSearchProvider(
831      TabContents* tab_contents,
832      TemplateURL* template_url,
833      TemplateURLModel* template_url_model) OVERRIDE;
834  virtual void ConfirmAddSearchProvider(const TemplateURL* template_url,
835                                        Profile* profile) OVERRIDE;
836
837  // Overridden from SelectFileDialog::Listener:
838  virtual void FileSelected(const FilePath& path, int index, void* params);
839
840  // Overridden from NotificationObserver:
841  virtual void Observe(NotificationType type,
842                       const NotificationSource& source,
843                       const NotificationDetails& details);
844
845  // Overridden from ProfileSyncServiceObserver:
846  virtual void OnStateChanged();
847
848  // Overriden from InstantDelegate:
849  virtual void PrepareForInstant() OVERRIDE;
850  virtual void ShowInstant(TabContentsWrapper* preview_contents) OVERRIDE;
851  virtual void HideInstant() OVERRIDE;
852  virtual void CommitInstant(TabContentsWrapper* preview_contents) OVERRIDE;
853  virtual void SetSuggestedText(const string16& text,
854                                InstantCompleteBehavior behavior) OVERRIDE;
855  virtual gfx::Rect GetInstantBounds() OVERRIDE;
856
857  // Command and state updating ///////////////////////////////////////////////
858
859  // Initialize state for all browser commands.
860  void InitCommandState();
861
862  // Update commands whose state depends on the tab's state.
863  void UpdateCommandsForTabState();
864
865  // Updates commands when the content's restrictions change.
866  void UpdateCommandsForContentRestrictionState();
867
868  // Updates commands for enabling developer tools.
869  void UpdateCommandsForDevTools();
870
871  // Updates commands for bookmark editing.
872  void UpdateCommandsForBookmarkEditing();
873
874  // Updates the printing command state.
875  void UpdatePrintingState(int content_restrictions);
876
877  // Ask the Reload/Stop button to change its icon, and update the Stop command
878  // state.  |is_loading| is true if the current TabContents is loading.
879  // |force| is true if the button should change its icon immediately.
880  void UpdateReloadStopState(bool is_loading, bool force);
881
882  // UI update coalescing and handling ////////////////////////////////////////
883
884  // Asks the toolbar (and as such the location bar) to update its state to
885  // reflect the current tab's current URL, security state, etc.
886  // If |should_restore_state| is true, we're switching (back?) to this tab and
887  // should restore any previous location bar state (such as user editing) as
888  // well.
889  void UpdateToolbar(bool should_restore_state);
890
891  // Does one or both of the following for each bit in |changed_flags|:
892  // . If the update should be processed immediately, it is.
893  // . If the update should processed asynchronously (to avoid lots of ui
894  //   updates), then scheduled_updates_ is updated for the |source| and update
895  //   pair and a task is scheduled (assuming it isn't running already)
896  //   that invokes ProcessPendingUIUpdates.
897  void ScheduleUIUpdate(const TabContents* source, unsigned changed_flags);
898
899  // Processes all pending updates to the UI that have been scheduled by
900  // ScheduleUIUpdate in scheduled_updates_.
901  void ProcessPendingUIUpdates();
902
903  // Removes all entries from scheduled_updates_ whose source is contents.
904  void RemoveScheduledUpdatesFor(TabContents* contents);
905
906  // Getters for UI ///////////////////////////////////////////////////////////
907
908  // TODO(beng): remove, and provide AutomationProvider a better way to access
909  //             the LocationBarView's edit.
910  friend class AutomationProvider;
911  friend class TestingAutomationProvider;
912
913  // Returns the StatusBubble from the current toolbar. It is possible for
914  // this to return NULL if called before the toolbar has initialized.
915  // TODO(beng): remove this.
916  StatusBubble* GetStatusBubble();
917
918  // Session restore functions ////////////////////////////////////////////////
919
920  // Notifies the history database of the index for all tabs whose index is
921  // >= index.
922  void SyncHistoryWithTabs(int index);
923
924  // OnBeforeUnload handling //////////////////////////////////////////////////
925
926  typedef std::set<TabContents*> UnloadListenerSet;
927
928  // Processes the next tab that needs it's beforeunload/unload event fired.
929  void ProcessPendingTabs();
930
931  // Whether we've completed firing all the tabs' beforeunload/unload events.
932  bool HasCompletedUnloadProcessing() const;
933
934  // Clears all the state associated with processing tabs' beforeunload/unload
935  // events since the user cancelled closing the window.
936  void CancelWindowClose();
937
938  // Removes |tab| from the passed |set|.
939  // Returns whether the tab was in the set in the first place.
940  // TODO(beng): this method needs a better name!
941  bool RemoveFromSet(UnloadListenerSet* set, TabContents* tab);
942
943  // Cleans up state appropriately when we are trying to close the browser and
944  // the tab has finished firing its unload handler. We also use this in the
945  // cases where a tab crashes or hangs even if the beforeunload/unload haven't
946  // successfully fired. If |process_now| is true |ProcessPendingTabs| is
947  // invoked immediately, otherwise it is invoked after a delay (PostTask).
948  //
949  // Typically you'll want to pass in true for |process_now|. Passing in true
950  // may result in deleting |tab|. If you know that shouldn't happen (because of
951  // the state of the stack), pass in false.
952  void ClearUnloadState(TabContents* tab, bool process_now);
953
954  // In-progress download termination handling /////////////////////////////////
955
956  // Called when the window is closing to check if potential in-progress
957  // downloads should prevent it from closing.
958  // Returns true if the window can close, false otherwise.
959  bool CanCloseWithInProgressDownloads();
960
961  // Assorted utility functions ///////////////////////////////////////////////
962
963  // Sets the delegate of all the parts of the |TabContentsWrapper| that
964  // are needed.
965  void SetAsDelegate(TabContentsWrapper* tab, Browser* delegate);
966
967  // Shows the Find Bar, optionally selecting the next entry that matches the
968  // existing search string for that Tab. |forward_direction| controls the
969  // search direction.
970  void FindInPage(bool find_next, bool forward_direction);
971
972  // Closes the frame.
973  // TODO(beng): figure out if we need this now that the frame itself closes
974  //             after a return to the message loop.
975  void CloseFrame();
976
977  void TabDetachedAtImpl(TabContentsWrapper* contents,
978      int index, DetachType type);
979
980  // Create a preference dictionary for the provided application name, in the
981  // given user profile. This is done only once per application name / per
982  // session / per user profile.
983  static void RegisterAppPrefs(const std::string& app_name, Profile* profile);
984
985  // Shared code between Reload() and ReloadIgnoringCache().
986  void ReloadInternal(WindowOpenDisposition disposition, bool ignore_cache);
987
988  // Return true if the window dispositions means opening a new tab.
989  bool ShouldOpenNewTabForWindowDisposition(WindowOpenDisposition disposition);
990
991  // Depending on the disposition, return the current tab or a clone of the
992  // current tab.
993  TabContents* GetOrCloneTabForDisposition(WindowOpenDisposition disposition);
994
995  // Sets the insertion policy of the tabstrip based on whether vertical tabs
996  // are enabled.
997  void UpdateTabStripModelInsertionPolicy();
998
999  // Invoked when the use vertical tabs preference changes. Resets the insertion
1000  // policy of the tab strip model and notifies the window.
1001  void UseVerticalTabsChanged();
1002
1003  // Implementation of SupportsWindowFeature and CanSupportWindowFeature. If
1004  // |check_fullscreen| is true, the set of features reflect the actual state of
1005  // the browser, otherwise the set of features reflect the possible state of
1006  // the browser.
1007  bool SupportsWindowFeatureImpl(WindowFeature feature,
1008                                 bool check_fullscreen) const;
1009
1010  // Determines if closing of browser can really be permitted after normal
1011  // sequence of downloads and unload handlers have given the go-ahead to close.
1012  // It is called from ShouldCloseWindow.  It checks with
1013  // TabCloseableStateWatcher to confirm if browser can really be closed.
1014  // Appropriate action is taken by watcher as it sees fit.
1015  // If watcher denies closing of browser, CancelWindowClose is called to
1016  // cancel closing of window.
1017  bool IsClosingPermitted();
1018
1019  // Commits the current instant, returning true on success. This is intended
1020  // for use from OpenCurrentURL.
1021  bool OpenInstant(WindowOpenDisposition disposition);
1022
1023  // If this browser should have instant one is created, otherwise does nothing.
1024  void CreateInstantIfNecessary();
1025
1026  // Opens view-source tab for given tab contents.
1027  void ViewSource(TabContentsWrapper* tab);
1028
1029  // Creates a NavigateParams struct for a singleton tab navigation.
1030  browser::NavigateParams GetSingletonTabNavigateParams(const GURL& url);
1031
1032  // Opens view-source tab for any frame within given tab contents.
1033  void ViewSource(TabContentsWrapper* tab,
1034                  const GURL& url,
1035                  const std::string& content_state);
1036
1037  // Data members /////////////////////////////////////////////////////////////
1038
1039  NotificationRegistrar registrar_;
1040
1041  // This Browser's type.
1042  const Type type_;
1043
1044  // This Browser's profile.
1045  Profile* const profile_;
1046
1047  // This Browser's window.
1048  BrowserWindow* window_;
1049
1050  // This Browser's current TabHandler.
1051  scoped_ptr<TabHandler> tab_handler_;
1052
1053  // The CommandUpdater that manages the browser window commands.
1054  CommandUpdater command_updater_;
1055
1056  // An optional application name which is used to retrieve and save window
1057  // positions.
1058  std::string app_name_;
1059
1060  // Unique identifier of this browser for session restore. This id is only
1061  // unique within the current session, and is not guaranteed to be unique
1062  // across sessions.
1063  const SessionID session_id_;
1064
1065  // The model for the toolbar view.
1066  ToolbarModel toolbar_model_;
1067
1068  // UI update coalescing and handling ////////////////////////////////////////
1069
1070  typedef std::map<const TabContents*, int> UpdateMap;
1071
1072  // Maps from TabContents to pending UI updates that need to be processed.
1073  // We don't update things like the URL or tab title right away to avoid
1074  // flickering and extra painting.
1075  // See ScheduleUIUpdate and ProcessPendingUIUpdates.
1076  UpdateMap scheduled_updates_;
1077
1078  // The following factory is used for chrome update coalescing.
1079  ScopedRunnableMethodFactory<Browser> chrome_updater_factory_;
1080
1081  // OnBeforeUnload handling //////////////////////////////////////////////////
1082
1083  // Tracks tabs that need there beforeunload event fired before we can
1084  // close the browser. Only gets populated when we try to close the browser.
1085  UnloadListenerSet tabs_needing_before_unload_fired_;
1086
1087  // Tracks tabs that need there unload event fired before we can
1088  // close the browser. Only gets populated when we try to close the browser.
1089  UnloadListenerSet tabs_needing_unload_fired_;
1090
1091  // Whether we are processing the beforeunload and unload events of each tab
1092  // in preparation for closing the browser.
1093  bool is_attempting_to_close_browser_;
1094
1095  // In-progress download termination handling /////////////////////////////////
1096
1097  enum CancelDownloadConfirmationState {
1098    NOT_PROMPTED,          // We have not asked the user.
1099    WAITING_FOR_RESPONSE,  // We have asked the user and have not received a
1100                           // reponse yet.
1101    RESPONSE_RECEIVED      // The user was prompted and made a decision already.
1102  };
1103
1104  // State used to figure-out whether we should prompt the user for confirmation
1105  // when the browser is closed with in-progress downloads.
1106  CancelDownloadConfirmationState cancel_download_confirmation_state_;
1107
1108  /////////////////////////////////////////////////////////////////////////////
1109
1110  // Override values for the bounds of the window and its maximized state.
1111  // These are supplied by callers that don't want to use the default values.
1112  // The default values are typically loaded from local state (last session),
1113  // obtained from the last window of the same type, or obtained from the
1114  // shell shortcut's startup info.
1115  gfx::Rect override_bounds_;
1116  MaximizedState maximized_state_;
1117
1118  // The following factory is used to close the frame at a later time.
1119  ScopedRunnableMethodFactory<Browser> method_factory_;
1120
1121  // The Find Bar. This may be NULL if there is no Find Bar, and if it is
1122  // non-NULL, it may or may not be visible.
1123  scoped_ptr<FindBarController> find_bar_controller_;
1124
1125  // Dialog box used for opening and saving files.
1126  scoped_refptr<SelectFileDialog> select_file_dialog_;
1127
1128  // Keep track of the encoding auto detect pref.
1129  BooleanPrefMember encoding_auto_detect_;
1130
1131  // Keep track of the printing enabled pref.
1132  BooleanPrefMember printing_enabled_;
1133
1134  // Keep track of the development tools disabled pref.
1135  BooleanPrefMember dev_tools_disabled_;
1136
1137  // Keep track of when instant enabled changes.
1138  BooleanPrefMember instant_enabled_;
1139
1140  // Tracks the preference that controls whether incognito mode is allowed.
1141  BooleanPrefMember incognito_mode_allowed_;
1142
1143  // Tracks whether bookmarks can be modified.
1144  BooleanPrefMember edit_bookmarks_enabled_;
1145
1146  // Indicates if command execution is blocked.
1147  bool block_command_execution_;
1148
1149  // Stores the last blocked command id when |block_command_execution_| is true.
1150  int last_blocked_command_id_;
1151
1152  // Stores the disposition type of the last blocked command.
1153  WindowOpenDisposition last_blocked_command_disposition_;
1154
1155  // Different types of action when web app info is available.
1156  // OnDidGetApplicationInfo uses this to dispatch calls.
1157  enum WebAppAction {
1158    NONE,             // No action at all.
1159    CREATE_SHORTCUT,  // Bring up create application shortcut dialog.
1160    UPDATE_SHORTCUT   // Update icon for app shortcut.
1161  };
1162
1163  // Which deferred action to perform when OnDidGetApplicationInfo is notified
1164  // from a TabContents. Currently, only one pending action is allowed.
1165  WebAppAction pending_web_app_action_;
1166
1167  // Tracks the display mode of the tabstrip.
1168  mutable BooleanPrefMember use_vertical_tabs_;
1169
1170  // The profile's tab restore service. The service is owned by the profile,
1171  // and we install ourselves as an observer.
1172  TabRestoreService* tab_restore_service_;
1173
1174  // Helper which implements the TabRestoreServiceDelegate interface.
1175  scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_;
1176
1177  scoped_ptr<InstantController> instant_;
1178  scoped_ptr<InstantUnloadHandler> instant_unload_handler_;
1179
1180  DISALLOW_COPY_AND_ASSIGN(Browser);
1181};
1182
1183#endif  // CHROME_BROWSER_UI_BROWSER_H_
1184