| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_BROWSER_H_ | 5 #ifndef CHROME_BROWSER_BROWSER_H_ |
| 6 #define CHROME_BROWSER_BROWSER_H_ | 6 #define CHROME_BROWSER_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/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
| 17 #include "base/string16.h" |
| 17 #include "base/task.h" | 18 #include "base/task.h" |
| 18 #include "chrome/browser/command_updater.h" | 19 #include "chrome/browser/command_updater.h" |
| 19 #include "chrome/browser/debugger/devtools_toggle_action.h" | 20 #include "chrome/browser/debugger/devtools_toggle_action.h" |
| 20 #include "chrome/browser/prefs/pref_member.h" | 21 #include "chrome/browser/prefs/pref_member.h" |
| 21 #include "chrome/browser/sessions/session_id.h" | 22 #include "chrome/browser/sessions/session_id.h" |
| 22 #include "chrome/browser/sessions/tab_restore_service_observer.h" | 23 #include "chrome/browser/sessions/tab_restore_service_observer.h" |
| 23 #include "chrome/browser/shell_dialogs.h" | 24 #include "chrome/browser/shell_dialogs.h" |
| 24 #include "chrome/browser/sync/profile_sync_service_observer.h" | 25 #include "chrome/browser/sync/profile_sync_service_observer.h" |
| 25 #include "chrome/browser/tabs/tab_strip_model.h" | 26 #include "chrome/browser/tabs/tab_strip_model.h" |
| 27 #include "chrome/browser/tab_contents/match_preview_delegate.h" |
| 26 #include "chrome/browser/tab_contents/page_navigator.h" | 28 #include "chrome/browser/tab_contents/page_navigator.h" |
| 27 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 29 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
| 28 #include "chrome/browser/toolbar_model.h" | 30 #include "chrome/browser/toolbar_model.h" |
| 29 #include "chrome/common/extensions/extension.h" | 31 #include "chrome/common/extensions/extension.h" |
| 30 #include "chrome/common/notification_registrar.h" | 32 #include "chrome/common/notification_registrar.h" |
| 31 #include "chrome/common/page_transition_types.h" | 33 #include "chrome/common/page_transition_types.h" |
| 32 #include "chrome/common/page_zoom.h" | 34 #include "chrome/common/page_zoom.h" |
| 33 #include "gfx/rect.h" | 35 #include "gfx/rect.h" |
| 34 | 36 |
| 35 class BrowserWindow; | 37 class BrowserWindow; |
| 36 class Extension; | 38 class Extension; |
| 37 class FindBarController; | 39 class FindBarController; |
| 40 class MatchPreview; |
| 38 class PrefService; | 41 class PrefService; |
| 39 class Profile; | 42 class Profile; |
| 40 class SessionStorageNamespace; | 43 class SessionStorageNamespace; |
| 41 class SkBitmap; | 44 class SkBitmap; |
| 42 class StatusBubble; | 45 class StatusBubble; |
| 43 class TabNavigation; | 46 class TabNavigation; |
| 44 namespace gfx { | 47 namespace gfx { |
| 45 class Point; | 48 class Point; |
| 46 } | 49 } |
| 47 | 50 |
| 48 class Browser : public TabStripModelDelegate, | 51 class Browser : public TabStripModelDelegate, |
| 49 public TabStripModelObserver, | 52 public TabStripModelObserver, |
| 50 public TabContentsDelegate, | 53 public TabContentsDelegate, |
| 51 public PageNavigator, | 54 public PageNavigator, |
| 52 public CommandUpdater::CommandUpdaterDelegate, | 55 public CommandUpdater::CommandUpdaterDelegate, |
| 53 public NotificationObserver, | 56 public NotificationObserver, |
| 54 public SelectFileDialog::Listener, | 57 public SelectFileDialog::Listener, |
| 55 public TabRestoreServiceObserver, | 58 public TabRestoreServiceObserver, |
| 56 public ProfileSyncServiceObserver { | 59 public ProfileSyncServiceObserver, |
| 60 public MatchPreviewDelegate { |
| 57 public: | 61 public: |
| 58 // If you change the values in this enum you'll need to update browser_proxy. | 62 // If you change the values in this enum you'll need to update browser_proxy. |
| 59 // TODO(sky): move into a common place that is referenced by both ui_tests | 63 // TODO(sky): move into a common place that is referenced by both ui_tests |
| 60 // and chrome. | 64 // and chrome. |
| 61 enum Type { | 65 enum Type { |
| 62 TYPE_NORMAL = 1, | 66 TYPE_NORMAL = 1, |
| 63 TYPE_POPUP = 2, | 67 TYPE_POPUP = 2, |
| 64 // The old-style app created via "Create application shortcuts". | 68 // The old-style app created via "Create application shortcuts". |
| 65 TYPE_APP = 4, | 69 TYPE_APP = 4, |
| 66 // The new-style app created by installing a crx. This kinda needs to be | 70 // The new-style app created by installing a crx. This kinda needs to be |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // possible. This does not show the window. You need to call window()->Show() | 160 // possible. This does not show the window. You need to call window()->Show() |
| 157 // to show it. | 161 // to show it. |
| 158 void CreateBrowserWindow(); | 162 void CreateBrowserWindow(); |
| 159 | 163 |
| 160 // Accessors //////////////////////////////////////////////////////////////// | 164 // Accessors //////////////////////////////////////////////////////////////// |
| 161 | 165 |
| 162 Type type() const { return type_; } | 166 Type type() const { return type_; } |
| 163 Profile* profile() const { return profile_; } | 167 Profile* profile() const { return profile_; } |
| 164 const std::vector<std::wstring>& user_data_dir_profiles() const; | 168 const std::vector<std::wstring>& user_data_dir_profiles() const; |
| 165 | 169 |
| 170 // Returns the MatchPreview or NULL if there is no MatchPreview for this |
| 171 // Browser. |
| 172 MatchPreview* match_preview() const { return match_preview_.get(); } |
| 173 |
| 166 #if defined(UNIT_TEST) | 174 #if defined(UNIT_TEST) |
| 167 // Sets the BrowserWindow. This is intended for testing and generally not | 175 // Sets the BrowserWindow. This is intended for testing and generally not |
| 168 // useful outside of testing. Use CreateBrowserWindow outside of testing, or | 176 // useful outside of testing. Use CreateBrowserWindow outside of testing, or |
| 169 // the static convenience methods that create a BrowserWindow for you. | 177 // the static convenience methods that create a BrowserWindow for you. |
| 170 void set_window(BrowserWindow* window) { | 178 void set_window(BrowserWindow* window) { |
| 171 DCHECK(!window_); | 179 DCHECK(!window_); |
| 172 window_ = window; | 180 window_ = window; |
| 173 } | 181 } |
| 174 #endif | 182 #endif |
| 175 | 183 |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 759 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
| 752 virtual void ShowRepostFormWarningDialog(TabContents* tab_contents); | 760 virtual void ShowRepostFormWarningDialog(TabContents* tab_contents); |
| 753 virtual void ShowContentSettingsWindow(ContentSettingsType content_type); | 761 virtual void ShowContentSettingsWindow(ContentSettingsType content_type); |
| 754 virtual void ShowCollectedCookiesDialog(TabContents* tab_contents); | 762 virtual void ShowCollectedCookiesDialog(TabContents* tab_contents); |
| 755 virtual bool ShouldAddNavigationToHistory( | 763 virtual bool ShouldAddNavigationToHistory( |
| 756 const history::HistoryAddPageArgs& add_page_args, | 764 const history::HistoryAddPageArgs& add_page_args, |
| 757 NavigationType::Type navigation_type); | 765 NavigationType::Type navigation_type); |
| 758 virtual void OnDidGetApplicationInfo(TabContents* tab_contents, | 766 virtual void OnDidGetApplicationInfo(TabContents* tab_contents, |
| 759 int32 page_id); | 767 int32 page_id); |
| 760 virtual void ContentTypeChanged(TabContents* source); | 768 virtual void ContentTypeChanged(TabContents* source); |
| 761 virtual void CommitMatchPreview(TabContents* source); | |
| 762 | 769 |
| 763 // Overridden from SelectFileDialog::Listener: | 770 // Overridden from SelectFileDialog::Listener: |
| 764 virtual void FileSelected(const FilePath& path, int index, void* params); | 771 virtual void FileSelected(const FilePath& path, int index, void* params); |
| 765 | 772 |
| 766 // Overridden from NotificationObserver: | 773 // Overridden from NotificationObserver: |
| 767 virtual void Observe(NotificationType type, | 774 virtual void Observe(NotificationType type, |
| 768 const NotificationSource& source, | 775 const NotificationSource& source, |
| 769 const NotificationDetails& details); | 776 const NotificationDetails& details); |
| 770 | 777 |
| 771 // Overridden from ProfileSyncServiceObserver: | 778 // Overridden from ProfileSyncServiceObserver: |
| 772 virtual void OnStateChanged(); | 779 virtual void OnStateChanged(); |
| 773 | 780 |
| 781 // Overriden from MatchPreviewDelegate: |
| 782 virtual void ShowMatchPreview(); |
| 783 virtual void HideMatchPreview(); |
| 784 virtual void CommitMatchPreview(); |
| 785 virtual void SetSuggestedText(const string16& text); |
| 786 |
| 774 // Command and state updating /////////////////////////////////////////////// | 787 // Command and state updating /////////////////////////////////////////////// |
| 775 | 788 |
| 776 // Initialize state for all browser commands. | 789 // Initialize state for all browser commands. |
| 777 void InitCommandState(); | 790 void InitCommandState(); |
| 778 | 791 |
| 779 // Update commands whose state depends on the tab's state. | 792 // Update commands whose state depends on the tab's state. |
| 780 void UpdateCommandsForTabState(); | 793 void UpdateCommandsForTabState(); |
| 781 | 794 |
| 782 // Update zoom commands based on the tab's state | 795 // Update zoom commands based on the tab's state |
| 783 void UpdateZoomCommandsForTabState(); | 796 void UpdateZoomCommandsForTabState(); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 // The extension app associated with this window, if any. | 1087 // The extension app associated with this window, if any. |
| 1075 Extension* extension_app_; | 1088 Extension* extension_app_; |
| 1076 | 1089 |
| 1077 // Tracks the display mode of the tabstrip. | 1090 // Tracks the display mode of the tabstrip. |
| 1078 mutable BooleanPrefMember use_vertical_tabs_; | 1091 mutable BooleanPrefMember use_vertical_tabs_; |
| 1079 | 1092 |
| 1080 // The profile's tab restore service. The service is owned by the profile, | 1093 // The profile's tab restore service. The service is owned by the profile, |
| 1081 // and we install ourselves as an observer. | 1094 // and we install ourselves as an observer. |
| 1082 TabRestoreService* tab_restore_service_; | 1095 TabRestoreService* tab_restore_service_; |
| 1083 | 1096 |
| 1097 scoped_ptr<MatchPreview> match_preview_; |
| 1098 |
| 1084 DISALLOW_COPY_AND_ASSIGN(Browser); | 1099 DISALLOW_COPY_AND_ASSIGN(Browser); |
| 1085 }; | 1100 }; |
| 1086 | 1101 |
| 1087 #endif // CHROME_BROWSER_BROWSER_H_ | 1102 #endif // CHROME_BROWSER_BROWSER_H_ |
| OLD | NEW |