| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_BROWSER_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_H_ |
| 6 #define CHROME_BROWSER_UI_BROWSER_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 11 #include <set> | 12 #include <set> |
| 12 #include <string> | 13 #include <string> |
| 13 #include <vector> | 14 #include <vector> |
| 14 | 15 |
| 15 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 16 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 17 #include "base/macros.h" | 18 #include "base/macros.h" |
| 18 #include "base/memory/scoped_ptr.h" | |
| 19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 20 #include "base/scoped_observer.h" | 20 #include "base/scoped_observer.h" |
| 21 #include "base/strings/string16.h" | 21 #include "base/strings/string16.h" |
| 22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
| 23 #include "chrome/browser/devtools/devtools_toggle_action.h" | 23 #include "chrome/browser/devtools/devtools_toggle_action.h" |
| 24 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" | 24 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" |
| 25 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper_delegate.h" | 25 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper_delegate.h" |
| 26 #include "chrome/browser/ui/browser_navigator.h" | 26 #include "chrome/browser/ui/browser_navigator.h" |
| 27 #include "chrome/browser/ui/chrome_bubble_manager.h" | 27 #include "chrome/browser/ui/chrome_bubble_manager.h" |
| 28 #include "chrome/browser/ui/chrome_web_modal_dialog_manager_delegate.h" | 28 #include "chrome/browser/ui/chrome_web_modal_dialog_manager_delegate.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 bool is_trusted_source() const { return is_trusted_source_; } | 239 bool is_trusted_source() const { return is_trusted_source_; } |
| 240 Profile* profile() const { return profile_; } | 240 Profile* profile() const { return profile_; } |
| 241 gfx::Rect override_bounds() const { return override_bounds_; } | 241 gfx::Rect override_bounds() const { return override_bounds_; } |
| 242 | 242 |
| 243 // |window()| will return NULL if called before |CreateBrowserWindow()| | 243 // |window()| will return NULL if called before |CreateBrowserWindow()| |
| 244 // is done. | 244 // is done. |
| 245 BrowserWindow* window() const { return window_; } | 245 BrowserWindow* window() const { return window_; } |
| 246 ToolbarModel* toolbar_model() { return toolbar_model_.get(); } | 246 ToolbarModel* toolbar_model() { return toolbar_model_.get(); } |
| 247 const ToolbarModel* toolbar_model() const { return toolbar_model_.get(); } | 247 const ToolbarModel* toolbar_model() const { return toolbar_model_.get(); } |
| 248 #if defined(UNIT_TEST) | 248 #if defined(UNIT_TEST) |
| 249 void swap_toolbar_models(scoped_ptr<ToolbarModel>* toolbar_model) { | 249 void swap_toolbar_models(std::unique_ptr<ToolbarModel>* toolbar_model) { |
| 250 toolbar_model->swap(toolbar_model_); | 250 toolbar_model->swap(toolbar_model_); |
| 251 } | 251 } |
| 252 #endif | 252 #endif |
| 253 TabStripModel* tab_strip_model() const { return tab_strip_model_.get(); } | 253 TabStripModel* tab_strip_model() const { return tab_strip_model_.get(); } |
| 254 chrome::BrowserCommandController* command_controller() { | 254 chrome::BrowserCommandController* command_controller() { |
| 255 return command_controller_.get(); | 255 return command_controller_.get(); |
| 256 } | 256 } |
| 257 SearchModel* search_model() { return search_model_.get(); } | 257 SearchModel* search_model() { return search_model_.get(); } |
| 258 const SearchModel* search_model() const { | 258 const SearchModel* search_model() const { |
| 259 return search_model_.get(); | 259 return search_model_.get(); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 const blink::WebGestureEvent& event) override; | 473 const blink::WebGestureEvent& event) override; |
| 474 bool CanDragEnter(content::WebContents* source, | 474 bool CanDragEnter(content::WebContents* source, |
| 475 const content::DropData& data, | 475 const content::DropData& data, |
| 476 blink::WebDragOperationsMask operations_allowed) override; | 476 blink::WebDragOperationsMask operations_allowed) override; |
| 477 content::SecurityStyle GetSecurityStyle( | 477 content::SecurityStyle GetSecurityStyle( |
| 478 content::WebContents* web_contents, | 478 content::WebContents* web_contents, |
| 479 content::SecurityStyleExplanations* security_style_explanations) override; | 479 content::SecurityStyleExplanations* security_style_explanations) override; |
| 480 void ShowCertificateViewerInDevTools( | 480 void ShowCertificateViewerInDevTools( |
| 481 content::WebContents* web_contents, | 481 content::WebContents* web_contents, |
| 482 int cert_id) override; | 482 int cert_id) override; |
| 483 scoped_ptr<content::BluetoothChooser> RunBluetoothChooser( | 483 std::unique_ptr<content::BluetoothChooser> RunBluetoothChooser( |
| 484 content::RenderFrameHost* frame, | 484 content::RenderFrameHost* frame, |
| 485 const content::BluetoothChooser::EventHandler& event_handler) override; | 485 const content::BluetoothChooser::EventHandler& event_handler) override; |
| 486 void RequestAppBannerFromDevTools( | 486 void RequestAppBannerFromDevTools( |
| 487 content::WebContents* web_contents) override; | 487 content::WebContents* web_contents) override; |
| 488 | 488 |
| 489 bool RequestAppBanner(content::WebContents* web_contents); | 489 bool RequestAppBanner(content::WebContents* web_contents); |
| 490 | 490 |
| 491 bool is_type_tabbed() const { return type_ == TYPE_TABBED; } | 491 bool is_type_tabbed() const { return type_ == TYPE_TABBED; } |
| 492 bool is_type_popup() const { return type_ == TYPE_POPUP; } | 492 bool is_type_popup() const { return type_ == TYPE_POPUP; } |
| 493 | 493 |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 | 880 |
| 881 // This Browser's type. | 881 // This Browser's type. |
| 882 const Type type_; | 882 const Type type_; |
| 883 | 883 |
| 884 // This Browser's profile. | 884 // This Browser's profile. |
| 885 Profile* const profile_; | 885 Profile* const profile_; |
| 886 | 886 |
| 887 // This Browser's window. | 887 // This Browser's window. |
| 888 BrowserWindow* window_; | 888 BrowserWindow* window_; |
| 889 | 889 |
| 890 scoped_ptr<TabStripModelDelegate> tab_strip_model_delegate_; | 890 std::unique_ptr<TabStripModelDelegate> tab_strip_model_delegate_; |
| 891 scoped_ptr<TabStripModel> tab_strip_model_; | 891 std::unique_ptr<TabStripModel> tab_strip_model_; |
| 892 | 892 |
| 893 // The application name that is also the name of the window to the shell. | 893 // The application name that is also the name of the window to the shell. |
| 894 // This name should be set when: | 894 // This name should be set when: |
| 895 // 1) we launch an application via an application shortcut or extension API. | 895 // 1) we launch an application via an application shortcut or extension API. |
| 896 // 2) we launch an undocked devtool window. | 896 // 2) we launch an undocked devtool window. |
| 897 std::string app_name_; | 897 std::string app_name_; |
| 898 | 898 |
| 899 // True if the source is trusted (i.e. we do not need to show the URL in a | 899 // True if the source is trusted (i.e. we do not need to show the URL in a |
| 900 // a popup window). Also used to determine which app windows to save and | 900 // a popup window). Also used to determine which app windows to save and |
| 901 // restore on Chrome OS. | 901 // restore on Chrome OS. |
| 902 bool is_trusted_source_; | 902 bool is_trusted_source_; |
| 903 | 903 |
| 904 // Unique identifier of this browser for session restore. This id is only | 904 // Unique identifier of this browser for session restore. This id is only |
| 905 // unique within the current session, and is not guaranteed to be unique | 905 // unique within the current session, and is not guaranteed to be unique |
| 906 // across sessions. | 906 // across sessions. |
| 907 const SessionID session_id_; | 907 const SessionID session_id_; |
| 908 | 908 |
| 909 // The model for the toolbar view. | 909 // The model for the toolbar view. |
| 910 scoped_ptr<ToolbarModel> toolbar_model_; | 910 std::unique_ptr<ToolbarModel> toolbar_model_; |
| 911 | 911 |
| 912 // The model for the "active" search state. There are per-tab search models | 912 // The model for the "active" search state. There are per-tab search models |
| 913 // as well. When a tab is active its model is kept in sync with this one. | 913 // as well. When a tab is active its model is kept in sync with this one. |
| 914 // When a new tab is activated its model state is propagated to this active | 914 // When a new tab is activated its model state is propagated to this active |
| 915 // model. This way, observers only have to attach to this single model for | 915 // model. This way, observers only have to attach to this single model for |
| 916 // updates, and don't have to worry about active tab changes directly. | 916 // updates, and don't have to worry about active tab changes directly. |
| 917 scoped_ptr<SearchModel> search_model_; | 917 std::unique_ptr<SearchModel> search_model_; |
| 918 | 918 |
| 919 // UI update coalescing and handling //////////////////////////////////////// | 919 // UI update coalescing and handling //////////////////////////////////////// |
| 920 | 920 |
| 921 typedef std::map<const content::WebContents*, int> UpdateMap; | 921 typedef std::map<const content::WebContents*, int> UpdateMap; |
| 922 | 922 |
| 923 // Maps from WebContents to pending UI updates that need to be processed. | 923 // Maps from WebContents to pending UI updates that need to be processed. |
| 924 // We don't update things like the URL or tab title right away to avoid | 924 // We don't update things like the URL or tab title right away to avoid |
| 925 // flickering and extra painting. | 925 // flickering and extra painting. |
| 926 // See ScheduleUIUpdate and ProcessPendingUIUpdates. | 926 // See ScheduleUIUpdate and ProcessPendingUIUpdates. |
| 927 UpdateMap scheduled_updates_; | 927 UpdateMap scheduled_updates_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 946 // These are supplied by callers that don't want to use the default values. | 946 // These are supplied by callers that don't want to use the default values. |
| 947 // The default values are typically loaded from local state (last session), | 947 // The default values are typically loaded from local state (last session), |
| 948 // obtained from the last window of the same type, or obtained from the | 948 // obtained from the last window of the same type, or obtained from the |
| 949 // shell shortcut's startup info. | 949 // shell shortcut's startup info. |
| 950 gfx::Rect override_bounds_; | 950 gfx::Rect override_bounds_; |
| 951 ui::WindowShowState initial_show_state_; | 951 ui::WindowShowState initial_show_state_; |
| 952 | 952 |
| 953 // Tracks when this browser is being created by session restore. | 953 // Tracks when this browser is being created by session restore. |
| 954 bool is_session_restore_; | 954 bool is_session_restore_; |
| 955 | 955 |
| 956 scoped_ptr<chrome::UnloadController> unload_controller_; | 956 std::unique_ptr<chrome::UnloadController> unload_controller_; |
| 957 scoped_ptr<chrome::FastUnloadController> fast_unload_controller_; | 957 std::unique_ptr<chrome::FastUnloadController> fast_unload_controller_; |
| 958 | 958 |
| 959 scoped_ptr<ChromeBubbleManager> bubble_manager_; | 959 std::unique_ptr<ChromeBubbleManager> bubble_manager_; |
| 960 | 960 |
| 961 // The Find Bar. This may be NULL if there is no Find Bar, and if it is | 961 // The Find Bar. This may be NULL if there is no Find Bar, and if it is |
| 962 // non-NULL, it may or may not be visible. | 962 // non-NULL, it may or may not be visible. |
| 963 scoped_ptr<FindBarController> find_bar_controller_; | 963 std::unique_ptr<FindBarController> find_bar_controller_; |
| 964 | 964 |
| 965 // Dialog box used for opening and saving files. | 965 // Dialog box used for opening and saving files. |
| 966 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; | 966 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; |
| 967 | 967 |
| 968 // Keep track of the encoding auto detect pref. | 968 // Keep track of the encoding auto detect pref. |
| 969 BooleanPrefMember encoding_auto_detect_; | 969 BooleanPrefMember encoding_auto_detect_; |
| 970 | 970 |
| 971 // Helper which implements the ContentSettingBubbleModel interface. | 971 // Helper which implements the ContentSettingBubbleModel interface. |
| 972 scoped_ptr<BrowserContentSettingBubbleModelDelegate> | 972 std::unique_ptr<BrowserContentSettingBubbleModelDelegate> |
| 973 content_setting_bubble_model_delegate_; | 973 content_setting_bubble_model_delegate_; |
| 974 | 974 |
| 975 // Helper which implements the ToolbarModelDelegate interface. | 975 // Helper which implements the ToolbarModelDelegate interface. |
| 976 scoped_ptr<BrowserToolbarModelDelegate> toolbar_model_delegate_; | 976 std::unique_ptr<BrowserToolbarModelDelegate> toolbar_model_delegate_; |
| 977 | 977 |
| 978 // A delegate that handles the details of updating the "active" | 978 // A delegate that handles the details of updating the "active" |
| 979 // |search_model_| state with the tab's state. | 979 // |search_model_| state with the tab's state. |
| 980 scoped_ptr<SearchDelegate> search_delegate_; | 980 std::unique_ptr<SearchDelegate> search_delegate_; |
| 981 | 981 |
| 982 // Helper which implements the LiveTabContext interface. | 982 // Helper which implements the LiveTabContext interface. |
| 983 scoped_ptr<BrowserLiveTabContext> live_tab_context_; | 983 std::unique_ptr<BrowserLiveTabContext> live_tab_context_; |
| 984 | 984 |
| 985 // Helper which implements the SyncedWindowDelegate interface. | 985 // Helper which implements the SyncedWindowDelegate interface. |
| 986 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; | 986 std::unique_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; |
| 987 | 987 |
| 988 scoped_ptr<BrowserInstantController> instant_controller_; | 988 std::unique_ptr<BrowserInstantController> instant_controller_; |
| 989 | 989 |
| 990 // Helper which handles bookmark app specific browser configuration. | 990 // Helper which handles bookmark app specific browser configuration. |
| 991 scoped_ptr<extensions::HostedAppBrowserController> hosted_app_controller_; | 991 std::unique_ptr<extensions::HostedAppBrowserController> |
| 992 hosted_app_controller_; |
| 992 | 993 |
| 993 BookmarkBar::State bookmark_bar_state_; | 994 BookmarkBar::State bookmark_bar_state_; |
| 994 | 995 |
| 995 scoped_ptr<ExclusiveAccessManager> exclusive_access_manager_; | 996 std::unique_ptr<ExclusiveAccessManager> exclusive_access_manager_; |
| 996 | 997 |
| 997 scoped_ptr<extensions::WindowController> extension_window_controller_; | 998 std::unique_ptr<extensions::WindowController> extension_window_controller_; |
| 998 | 999 |
| 999 scoped_ptr<chrome::BrowserCommandController> command_controller_; | 1000 std::unique_ptr<chrome::BrowserCommandController> command_controller_; |
| 1000 | 1001 |
| 1001 // True if the browser window has been shown at least once. | 1002 // True if the browser window has been shown at least once. |
| 1002 bool window_has_shown_; | 1003 bool window_has_shown_; |
| 1003 | 1004 |
| 1004 scoped_ptr<ValidationMessageBubble> validation_message_bubble_; | 1005 std::unique_ptr<ValidationMessageBubble> validation_message_bubble_; |
| 1005 | 1006 |
| 1006 SigninViewController signin_view_controller_; | 1007 SigninViewController signin_view_controller_; |
| 1007 | 1008 |
| 1008 scoped_ptr<ScopedKeepAlive> keep_alive_; | 1009 std::unique_ptr<ScopedKeepAlive> keep_alive_; |
| 1009 | 1010 |
| 1010 // The following factory is used for chrome update coalescing. | 1011 // The following factory is used for chrome update coalescing. |
| 1011 base::WeakPtrFactory<Browser> chrome_updater_factory_; | 1012 base::WeakPtrFactory<Browser> chrome_updater_factory_; |
| 1012 | 1013 |
| 1013 // The following factory is used to close the frame at a later time. | 1014 // The following factory is used to close the frame at a later time. |
| 1014 base::WeakPtrFactory<Browser> weak_factory_; | 1015 base::WeakPtrFactory<Browser> weak_factory_; |
| 1015 | 1016 |
| 1016 DISALLOW_COPY_AND_ASSIGN(Browser); | 1017 DISALLOW_COPY_AND_ASSIGN(Browser); |
| 1017 }; | 1018 }; |
| 1018 | 1019 |
| 1019 #endif // CHROME_BROWSER_UI_BROWSER_H_ | 1020 #endif // CHROME_BROWSER_UI_BROWSER_H_ |
| OLD | NEW |