diff options
author | altimofeev@chromium.org <altimofeev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-16 10:05:33 +0000 |
---|---|---|
committer | altimofeev@chromium.org <altimofeev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-16 10:05:33 +0000 |
commit | ef5570297e5d4e5f40089d34c0e68e7607562933 (patch) | |
tree | cadeed4d23f914831f2a32fe179416d93bc704fc | |
parent | dd442d7460ada03ca97904c2de098b57c94d0475 (diff) | |
download | chromium_src-ef5570297e5d4e5f40089d34c0e68e7607562933.zip chromium_src-ef5570297e5d4e5f40089d34c0e68e7607562933.tar.gz chromium_src-ef5570297e5d4e5f40089d34c0e68e7607562933.tar.bz2 |
Re-factor location bar/toolbar code to get rid of the browser dependency. This CL is needed to allow code reusing by captive portal view, which will show web content using DomView.
BUG=chromium-os:22630
TEST=browser_tests,unit_tests works
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=126959
Reverted because of a misprint which was hidden by overloaded method (ExecuteCommand): http://codereview.chromium.org/9703099/
Review URL: http://codereview.chromium.org/9479008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127145 0039d316-1c4b-4281-b951-d872f2087c98
31 files changed, 541 insertions, 245 deletions
diff --git a/chrome/browser/command_updater.cc b/chrome/browser/command_updater.cc index 4a1b0db..3642db4 100644 --- a/chrome/browser/command_updater.cc +++ b/chrome/browser/command_updater.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -41,8 +41,14 @@ bool CommandUpdater::SupportsCommand(int id) const { } void CommandUpdater::ExecuteCommand(int id) { + ExecuteCommandWithDisposition(id, CURRENT_TAB); +} + +void CommandUpdater::ExecuteCommandWithDisposition( + int id, + WindowOpenDisposition disposition) { if (IsCommandEnabled(id)) - delegate_->ExecuteCommand(id); + delegate_->ExecuteCommandWithDisposition(id, disposition); } CommandUpdater::CommandObserver::~CommandObserver() { diff --git a/chrome/browser/command_updater.h b/chrome/browser/command_updater.h index 024658d..80d8350 100644 --- a/chrome/browser/command_updater.h +++ b/chrome/browser/command_updater.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "base/hash_tables.h" +#include "webkit/glue/window_open_disposition.h" //////////////////////////////////////////////////////////////////////////////// // @@ -23,8 +24,11 @@ class CommandUpdater { // when needed. class CommandUpdaterDelegate { public: - // Perform the action associated with the command with the specified ID. - virtual void ExecuteCommand(int id) = 0; + // Performs the action associated with the command with the specified ID and + // using the given disposition. + virtual void ExecuteCommandWithDisposition( + int id, + WindowOpenDisposition disposition) = 0; protected: virtual ~CommandUpdaterDelegate(); @@ -42,11 +46,19 @@ class CommandUpdater { // supported by this updater. bool IsCommandEnabled(int id) const; - // Performs the action associated with this command ID. + // Performs the action associated with this command ID using CURRENT_TAB + // disposition. // TODO(beng): get rid of this since it's effectively just a pass-thru and the // call sites would be better off using more well defined delegate interfaces. void ExecuteCommand(int id); + // Performs the action associated with this command ID using the given + // disposition. + // TODO(altimofeev): refactor the interface to provide more flexible and + // explicit way for passing command specific arguments. See + // NotificationDetails class for the possible implementation ideas. + void ExecuteCommandWithDisposition(int id, WindowOpenDisposition disposition); + // An Observer interface implemented by objects that want to be informed when // the state of a particular command ID is modified. class CommandObserver { diff --git a/chrome/browser/command_updater_unittest.cc b/chrome/browser/command_updater_unittest.cc index 659e3c6..5dcc737 100644 --- a/chrome/browser/command_updater_unittest.cc +++ b/chrome/browser/command_updater_unittest.cc @@ -1,14 +1,16 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/compiler_specific.h" #include "chrome/browser/command_updater.h" #include "testing/gtest/include/gtest/gtest.h" class TestingCommandHandlerMock : public CommandUpdater::CommandUpdaterDelegate { public: - virtual void ExecuteCommand(int id) { + virtual void ExecuteCommandWithDisposition(int id, + WindowOpenDisposition) OVERRIDE { EXPECT_EQ(1, id); } }; diff --git a/chrome/browser/sync/sync_global_error_unittest.cc b/chrome/browser/sync/sync_global_error_unittest.cc index 7405def..0f7943e 100644 --- a/chrome/browser/sync/sync_global_error_unittest.cc +++ b/chrome/browser/sync/sync_global_error_unittest.cc @@ -17,9 +17,10 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +using ::testing::NiceMock; using ::testing::Return; using ::testing::ReturnRef; -using ::testing::NiceMock; +using ::testing::_; using content::BrowserThread; namespace { @@ -28,7 +29,8 @@ class BrowserMock: public Browser { public: explicit BrowserMock(Type type, Profile* profile) : Browser(type, profile) {} - MOCK_METHOD1(ExecuteCommand, void(int command_id)); + MOCK_METHOD2(ExecuteCommandWithDisposition, + void(int command_id, WindowOpenDisposition)); }; // Same as BrowserWithTestWindowTest, but uses MockBrowser to test calls to @@ -87,7 +89,8 @@ void VerifySyncGlobalErrorResult(NiceMock<ProfileSyncServiceMock>* service, #if defined(OS_CHROMEOS) if (error_state != GoogleServiceAuthError::NONE) { // In CrOS sign-in/sign-out is made to fix the error. - EXPECT_CALL(*static_cast<BrowserMock*>(browser), ExecuteCommand(IDC_EXIT)); + EXPECT_CALL(*static_cast<BrowserMock*>(browser), + ExecuteCommandWithDisposition(IDC_EXIT, _)); error->ExecuteMenuItem(browser); } #else diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index fc2d058..15a3b04 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -103,10 +103,12 @@ #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" +#include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" +#include "chrome/browser/ui/browser_toolbar_model_delegate.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/constrained_window_tab_helper.h" #include "chrome/browser/ui/extensions/shell_window.h" @@ -339,7 +341,6 @@ Browser::Browser(Type type, Profile* profile) ALLOW_THIS_IN_INITIALIZER_LIST( tab_handler_(TabHandler::CreateTabHandler(this))), command_updater_(this), - toolbar_model_(this), chrome_updater_factory_(this), is_attempting_to_close_browser_(false), cancel_download_confirmation_state_(NOT_PROMPTED), @@ -351,6 +352,12 @@ Browser::Browser(Type type, Profile* profile) last_blocked_command_disposition_(CURRENT_TAB), pending_web_app_action_(NONE), ALLOW_THIS_IN_INITIALIZER_LIST( + content_setting_bubble_model_delegate_( + new BrowserContentSettingBubbleModelDelegate(this))), + ALLOW_THIS_IN_INITIALIZER_LIST( + toolbar_model_delegate_( + new BrowserToolbarModelDelegate(this))), + ALLOW_THIS_IN_INITIALIZER_LIST( tab_restore_service_delegate_( new BrowserTabRestoreServiceDelegate(this))), ALLOW_THIS_IN_INITIALIZER_LIST( @@ -358,6 +365,8 @@ Browser::Browser(Type type, Profile* profile) new BrowserSyncedWindowDelegate(this))), bookmark_bar_state_(BookmarkBar::HIDDEN), window_has_shown_(false) { + toolbar_model_.reset(new ToolbarModel(toolbar_model_delegate_.get())); + registrar_.Add(this, content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, content::NotificationService::AllSources()); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, @@ -1862,7 +1871,7 @@ void Browser::WriteCurrentURLToClipboard() { // RenderContextViewMenu. WebContents* contents = GetSelectedWebContents(); - if (!toolbar_model_.ShouldDisplayURL()) + if (!toolbar_model_->ShouldDisplayURL()) return; chrome_browser_net::WriteURLToClipboard( @@ -2916,6 +2925,115 @@ void Browser::UpdateTargetURLHelper(WebContents* tab, int32 page_id, tcw->prerender_tab_helper()->UpdateTargetURL(page_id, url); } +void Browser::ExecuteCommand(int id) { + ExecuteCommandWithDisposition(id, CURRENT_TAB); +} + +void Browser::ExecuteCommand(int id, int event_flags) { + ExecuteCommandWithDisposition( + id, browser::DispositionFromEventFlags(event_flags)); +} + +bool Browser::ExecuteCommandIfEnabled(int id) { + if (command_updater_.SupportsCommand(id) && + command_updater_.IsCommandEnabled(id)) { + ExecuteCommand(id); + return true; + } + return false; +} + +bool Browser::IsReservedCommandOrKey(int command_id, + const NativeWebKeyboardEvent& event) { +#if defined(OS_CHROMEOS) + // Chrome OS's top row of keys produces F1-10. Make sure that web pages + // aren't able to block Chrome from performing the standard actions for F1-F4 + // (F5-7 are grabbed by other X clients and hence don't need this protection, + // and F8-10 are handled separately in Chrome via a GDK event filter, but + // let's future-proof this). + ui::KeyboardCode key_code = + static_cast<ui::KeyboardCode>(event.windowsKeyCode); + if (key_code == ui::VKEY_F1 || + key_code == ui::VKEY_F2 || + key_code == ui::VKEY_F3 || + key_code == ui::VKEY_F4 || + key_code == ui::VKEY_F5 || + key_code == ui::VKEY_F6 || + key_code == ui::VKEY_F7 || + key_code == ui::VKEY_F8 || + key_code == ui::VKEY_F9 || + key_code == ui::VKEY_F10) { + return true; + } +#endif + + if (window_->IsFullscreen() && command_id == IDC_FULLSCREEN) + return true; + return command_id == IDC_CLOSE_TAB || + command_id == IDC_CLOSE_WINDOW || + command_id == IDC_NEW_INCOGNITO_WINDOW || + command_id == IDC_NEW_TAB || + command_id == IDC_NEW_WINDOW || + command_id == IDC_RESTORE_TAB || + command_id == IDC_SELECT_NEXT_TAB || + command_id == IDC_SELECT_PREVIOUS_TAB || + command_id == IDC_TABPOSE || + command_id == IDC_EXIT || + command_id == IDC_SEARCH; +} + +void Browser::SetBlockCommandExecution(bool block) { + block_command_execution_ = block; + if (block) { + last_blocked_command_id_ = -1; + last_blocked_command_disposition_ = CURRENT_TAB; + } +} + +int Browser::GetLastBlockedCommand(WindowOpenDisposition* disposition) { + if (disposition) + *disposition = last_blocked_command_disposition_; + return last_blocked_command_id_; +} + +void Browser::UpdateUIForNavigationInTab(TabContentsWrapper* contents, + content::PageTransition transition, + bool user_initiated) { + tab_handler_->GetTabStripModel()->TabNavigating(contents, transition); + + bool contents_is_selected = contents == GetSelectedTabContentsWrapper(); + if (user_initiated && contents_is_selected && window()->GetLocationBar()) { + // Forcibly reset the location bar if the url is going to change in the + // current tab, since otherwise it won't discard any ongoing user edits, + // since it doesn't realize this is a user-initiated action. + window()->GetLocationBar()->Revert(); + } + + if (GetStatusBubble()) + GetStatusBubble()->Hide(); + + // Update the location bar. This is synchronous. We specifically don't + // update the load state since the load hasn't started yet and updating it + // will put it out of sync with the actual state like whether we're + // displaying a favicon, which controls the throbber. If we updated it here, + // the throbber will show the default favicon for a split second when + // navigating away from the new tab page. + ScheduleUIUpdate(contents->web_contents(), content::INVALIDATE_TYPE_URL); + + if (contents_is_selected) + contents->web_contents()->Focus(); +} + +/////////////////////////////////////////////////////////////////////////////// +// Browser, PageNavigator implementation: + +WebContents* Browser::OpenURL(const OpenURLParams& params) { + return OpenURLFromTab(NULL, params); +} + +/////////////////////////////////////////////////////////////////////////////// +// Browser, CommandUpdater::CommandUpdaterDelegate implementation: + void Browser::ExecuteCommandWithDisposition( int id, WindowOpenDisposition disposition) { // No commands are enabled if there is not yet any selected tab. @@ -3114,115 +3232,6 @@ void Browser::ExecuteCommandWithDisposition( } } -void Browser::ExecuteCommand(int id, int event_flags) { - ExecuteCommandWithDisposition( - id, browser::DispositionFromEventFlags(event_flags)); -} - -bool Browser::ExecuteCommandIfEnabled(int id) { - if (command_updater_.SupportsCommand(id) && - command_updater_.IsCommandEnabled(id)) { - ExecuteCommand(id); - return true; - } - return false; -} - -bool Browser::IsReservedCommandOrKey(int command_id, - const NativeWebKeyboardEvent& event) { -#if defined(OS_CHROMEOS) - // Chrome OS's top row of keys produces F1-10. Make sure that web pages - // aren't able to block Chrome from performing the standard actions for F1-F4 - // (F5-7 are grabbed by other X clients and hence don't need this protection, - // and F8-10 are handled separately in Chrome via a GDK event filter, but - // let's future-proof this). - ui::KeyboardCode key_code = - static_cast<ui::KeyboardCode>(event.windowsKeyCode); - if (key_code == ui::VKEY_F1 || - key_code == ui::VKEY_F2 || - key_code == ui::VKEY_F3 || - key_code == ui::VKEY_F4 || - key_code == ui::VKEY_F5 || - key_code == ui::VKEY_F6 || - key_code == ui::VKEY_F7 || - key_code == ui::VKEY_F8 || - key_code == ui::VKEY_F9 || - key_code == ui::VKEY_F10) { - return true; - } -#endif - - if (window_->IsFullscreen() && command_id == IDC_FULLSCREEN) - return true; - return command_id == IDC_CLOSE_TAB || - command_id == IDC_CLOSE_WINDOW || - command_id == IDC_NEW_INCOGNITO_WINDOW || - command_id == IDC_NEW_TAB || - command_id == IDC_NEW_WINDOW || - command_id == IDC_RESTORE_TAB || - command_id == IDC_SELECT_NEXT_TAB || - command_id == IDC_SELECT_PREVIOUS_TAB || - command_id == IDC_TABPOSE || - command_id == IDC_EXIT || - command_id == IDC_SEARCH; -} - -void Browser::SetBlockCommandExecution(bool block) { - block_command_execution_ = block; - if (block) { - last_blocked_command_id_ = -1; - last_blocked_command_disposition_ = CURRENT_TAB; - } -} - -int Browser::GetLastBlockedCommand(WindowOpenDisposition* disposition) { - if (disposition) - *disposition = last_blocked_command_disposition_; - return last_blocked_command_id_; -} - -void Browser::UpdateUIForNavigationInTab(TabContentsWrapper* contents, - content::PageTransition transition, - bool user_initiated) { - tab_handler_->GetTabStripModel()->TabNavigating(contents, transition); - - bool contents_is_selected = contents == GetSelectedTabContentsWrapper(); - if (user_initiated && contents_is_selected && window()->GetLocationBar()) { - // Forcibly reset the location bar if the url is going to change in the - // current tab, since otherwise it won't discard any ongoing user edits, - // since it doesn't realize this is a user-initiated action. - window()->GetLocationBar()->Revert(); - } - - if (GetStatusBubble()) - GetStatusBubble()->Hide(); - - // Update the location bar. This is synchronous. We specifically don't - // update the load state since the load hasn't started yet and updating it - // will put it out of sync with the actual state like whether we're - // displaying a favicon, which controls the throbber. If we updated it here, - // the throbber will show the default favicon for a split second when - // navigating away from the new tab page. - ScheduleUIUpdate(contents->web_contents(), content::INVALIDATE_TYPE_URL); - - if (contents_is_selected) - contents->web_contents()->Focus(); -} - -/////////////////////////////////////////////////////////////////////////////// -// Browser, PageNavigator implementation: - -WebContents* Browser::OpenURL(const OpenURLParams& params) { - return OpenURLFromTab(NULL, params); -} - -/////////////////////////////////////////////////////////////////////////////// -// Browser, CommandUpdater::CommandUpdaterDelegate implementation: - -void Browser::ExecuteCommand(int id) { - ExecuteCommandWithDisposition(id, CURRENT_TAB); -} - /////////////////////////////////////////////////////////////////////////////// // Browser, TabHandlerDelegate implementation: @@ -4882,7 +4891,7 @@ void Browser::UpdateCommandsForTabState() { command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, current_tab->GetController().CanViewSource()); command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, - toolbar_model_.ShouldDisplayURL() && current_tab->GetURL().is_valid()); + toolbar_model_->ShouldDisplayURL() && current_tab->GetURL().is_valid()); if (is_devtools()) command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, false); diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index 3c13726..b27c809 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -52,7 +52,9 @@ #include "ui/base/ui_base_types.h" #include "ui/gfx/rect.h" +class BrowserContentSettingBubbleModelDelegate; class BrowserSyncedWindowDelegate; +class BrowserToolbarModelDelegate; class BrowserTabRestoreServiceDelegate; class BrowserWindow; class Extension; @@ -234,10 +236,14 @@ class Browser : public TabHandlerDelegate, // |window()| will return NULL if called before |CreateBrowserWindow()| // is done. BrowserWindow* window() const { return window_; } - ToolbarModel* toolbar_model() { return &toolbar_model_; } + ToolbarModel* toolbar_model() { return toolbar_model_.get(); } const SessionID& session_id() const { return session_id_; } CommandUpdater* command_updater() { return &command_updater_; } bool block_command_execution() const { return block_command_execution_; } + BrowserContentSettingBubbleModelDelegate* + content_setting_bubble_model_delegate() { + return content_setting_bubble_model_delegate_.get(); + } BrowserTabRestoreServiceDelegate* tab_restore_service_delegate() { return tab_restore_service_delegate_.get(); } @@ -749,8 +755,8 @@ class Browser : public TabHandlerDelegate, static void UpdateTargetURLHelper(content::WebContents* tab, int32 page_id, const GURL& url); - // Calls ExecuteCommandWithDisposition with the given disposition. - void ExecuteCommandWithDisposition(int id, WindowOpenDisposition); + // Calls ExecuteCommandWithDisposition with CURRENT_TAB disposition. + void ExecuteCommand(int id); // Calls ExecuteCommandWithDisposition with the given event flags. void ExecuteCommand(int id, int event_flags); @@ -793,7 +799,9 @@ class Browser : public TabHandlerDelegate, const content::OpenURLParams& params) OVERRIDE; // Overridden from CommandUpdater::CommandUpdaterDelegate: - virtual void ExecuteCommand(int id) OVERRIDE; + virtual void ExecuteCommandWithDisposition( + int id, + WindowOpenDisposition disposition) OVERRIDE; // Overridden from TabRestoreServiceObserver: virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE; @@ -1362,7 +1370,7 @@ class Browser : public TabHandlerDelegate, const SessionID session_id_; // The model for the toolbar view. - ToolbarModel toolbar_model_; + scoped_ptr<ToolbarModel> toolbar_model_; // UI update coalescing and handling //////////////////////////////////////// @@ -1456,6 +1464,13 @@ class Browser : public TabHandlerDelegate, // and we install ourselves as an observer. TabRestoreService* tab_restore_service_; + // Helper which implements the ContentSettingBubbleModel interface. + scoped_ptr<BrowserContentSettingBubbleModelDelegate> + content_setting_bubble_model_delegate_; + + // Helper which implements the ToolbarModelDelegate interface. + scoped_ptr<BrowserToolbarModelDelegate> toolbar_model_delegate_; + // Helper which implements the TabRestoreServiceDelegate interface. scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; diff --git a/chrome/browser/ui/browser_content_setting_bubble_model_delegate.cc b/chrome/browser/ui/browser_content_setting_bubble_model_delegate.cc new file mode 100644 index 0000000..983f5e2 --- /dev/null +++ b/chrome/browser/ui/browser_content_setting_bubble_model_delegate.cc @@ -0,0 +1,25 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" + +#include "chrome/browser/ui/browser.h" + +BrowserContentSettingBubbleModelDelegate:: +BrowserContentSettingBubbleModelDelegate(Browser* browser) : browser_(browser) { +} + +BrowserContentSettingBubbleModelDelegate:: +~BrowserContentSettingBubbleModelDelegate() { +} + +void BrowserContentSettingBubbleModelDelegate::ShowCollectedCookiesDialog( + TabContentsWrapper* contents) { + browser_->ShowCollectedCookiesDialog(contents); +} + +void BrowserContentSettingBubbleModelDelegate::ShowContentSettingsPage( + ContentSettingsType type) { + browser_->ShowContentSettingsPage(type); +} diff --git a/chrome/browser/ui/browser_content_setting_bubble_model_delegate.h b/chrome/browser/ui/browser_content_setting_bubble_model_delegate.h new file mode 100644 index 0000000..c9e3542 --- /dev/null +++ b/chrome/browser/ui/browser_content_setting_bubble_model_delegate.h @@ -0,0 +1,34 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_BROWSER_CONTENT_SETTING_BUBBLE_MODEL_DELEGATE_H_ +#define CHROME_BROWSER_UI_BROWSER_CONTENT_SETTING_BUBBLE_MODEL_DELEGATE_H_ +#pragma once + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "chrome/browser/ui/content_settings/content_setting_bubble_model_delegate.h" + +class Browser; + +// Implementation of ContentSettingBubbleModelDelegate which uses an instance of +// Browser in order to fulfil its duties. +class BrowserContentSettingBubbleModelDelegate + : public ContentSettingBubbleModelDelegate { + public: + explicit BrowserContentSettingBubbleModelDelegate(Browser* browser); + virtual ~BrowserContentSettingBubbleModelDelegate(); + + // ContentSettingBubbleModelDelegate implementation: + virtual void ShowCollectedCookiesDialog( + TabContentsWrapper* contents) OVERRIDE; + virtual void ShowContentSettingsPage(ContentSettingsType type) OVERRIDE; + + private: + Browser* browser_; + + DISALLOW_COPY_AND_ASSIGN(BrowserContentSettingBubbleModelDelegate); +}; + +#endif // CHROME_BROWSER_UI_BROWSER_CONTENT_SETTING_BUBBLE_MODEL_DELEGATE_H_ diff --git a/chrome/browser/ui/browser_toolbar_model_delegate.cc b/chrome/browser/ui/browser_toolbar_model_delegate.cc new file mode 100644 index 0000000..e93f33b --- /dev/null +++ b/chrome/browser/ui/browser_toolbar_model_delegate.cc @@ -0,0 +1,19 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/browser_toolbar_model_delegate.h" + +#include "chrome/browser/ui/browser.h" + +BrowserToolbarModelDelegate::BrowserToolbarModelDelegate(Browser* browser) + : browser_(browser) { +} + +BrowserToolbarModelDelegate::~BrowserToolbarModelDelegate() { +} + +content::WebContents* +BrowserToolbarModelDelegate::GetActiveWebContents() const { + return browser_->GetSelectedWebContents(); +} diff --git a/chrome/browser/ui/browser_toolbar_model_delegate.h b/chrome/browser/ui/browser_toolbar_model_delegate.h new file mode 100644 index 0000000..dd38ba1f --- /dev/null +++ b/chrome/browser/ui/browser_toolbar_model_delegate.h @@ -0,0 +1,31 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_BROWSER_TOOLBAR_MODEL_DELEGATE_H_ +#define CHROME_BROWSER_UI_BROWSER_TOOLBAR_MODEL_DELEGATE_H_ +#pragma once + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" + +class Browser; + +// Implementation of ToolbarModelDelegate which uses an instance of +// Browser in order to fulfil its duties. +class BrowserToolbarModelDelegate : public ToolbarModelDelegate { + public: + explicit BrowserToolbarModelDelegate(Browser* browser); + virtual ~BrowserToolbarModelDelegate(); + + // ToolbarModelDelegate implementation: + virtual content::WebContents* GetActiveWebContents() const OVERRIDE; + + private: + Browser* browser_; + + DISALLOW_COPY_AND_ASSIGN(BrowserToolbarModelDelegate); +}; + +#endif // CHROME_BROWSER_UI_BROWSER_TOOLBAR_MODEL_DELEGATE_H_ diff --git a/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm b/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm index d0f17a7..47610c7 100644 --- a/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm +++ b/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,6 +11,7 @@ #include "chrome/browser/content_settings/tab_specific_content_settings.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" #include "chrome/browser/ui/browser_list.h" #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h" #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" @@ -278,7 +279,8 @@ bool ContentSettingDecoration::OnMousePressed(NSRect frame) { // Open bubble. ContentSettingBubbleModel* model = ContentSettingBubbleModel::CreateContentSettingBubbleModel( - browser, tabContents, profile_, + browser->content_setting_bubble_model_delegate(), + tabContents, profile_, content_setting_image_model_->get_content_settings_type()); [ContentSettingBubbleController showForModel:model parentWindow:[field window] diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h index aa6d19f..f61e679 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h @@ -17,6 +17,7 @@ #include "chrome/browser/autocomplete/autocomplete_edit.h" #include "chrome/browser/extensions/image_loading_tracker.h" #include "chrome/browser/prefs/pref_member.h" +#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" #include "chrome/browser/ui/omnibox/location_bar.h" #include "chrome/browser/ui/toolbar/toolbar_model.h" diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc index ad7398e..4978542 100644 --- a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc @@ -14,8 +14,8 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.h" -#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" +#include "chrome/browser/ui/content_settings/content_setting_bubble_model_delegate.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/content_settings.h" @@ -57,12 +57,12 @@ int GetIdForContentType(const ContentSettingsTypeIdEntry* entries, class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel { public: - ContentSettingTitleAndLinkModel(Browser* browser, + ContentSettingTitleAndLinkModel(Delegate* delegate, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type) : ContentSettingBubbleModel(tab_contents, profile, content_type), - browser_(browser) { + delegate_(delegate) { // Notifications do not have a bubble. DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_NOTIFICATIONS); SetBlockedResources(); @@ -71,7 +71,7 @@ class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel { } virtual ~ContentSettingTitleAndLinkModel() {} - Browser* browser() const { return browser_; } + Delegate* delegate() const { return delegate_; } private: void SetBlockedResources() { @@ -131,22 +131,22 @@ class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel { } virtual void OnManageLinkClicked() { - if (browser_) - browser_->ShowContentSettingsPage(content_type()); + if (delegate_) + delegate_->ShowContentSettingsPage(content_type()); } - Browser* browser_; + Delegate* delegate_; }; class ContentSettingTitleLinkAndCustomModel : public ContentSettingTitleAndLinkModel { public: - ContentSettingTitleLinkAndCustomModel(Browser* browser, + ContentSettingTitleLinkAndCustomModel(Delegate* delegate, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type) : ContentSettingTitleAndLinkModel( - browser, tab_contents, profile, content_type) { + delegate, tab_contents, profile, content_type) { SetCustomLink(); } @@ -171,11 +171,11 @@ class ContentSettingTitleLinkAndCustomModel class ContentSettingSingleRadioGroup : public ContentSettingTitleLinkAndCustomModel { public: - ContentSettingSingleRadioGroup(Browser* browser, + ContentSettingSingleRadioGroup(Delegate* delegate, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type) - : ContentSettingTitleLinkAndCustomModel(browser, tab_contents, profile, + : ContentSettingTitleLinkAndCustomModel(delegate, tab_contents, profile, content_type), block_setting_(CONTENT_SETTING_BLOCK), selected_item_(0) { @@ -333,12 +333,12 @@ class ContentSettingSingleRadioGroup class ContentSettingCookiesBubbleModel : public ContentSettingSingleRadioGroup { public: - ContentSettingCookiesBubbleModel(Browser* browser, + ContentSettingCookiesBubbleModel(Delegate* delegate, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type) : ContentSettingSingleRadioGroup( - browser, tab_contents, profile, content_type) { + delegate, tab_contents, profile, content_type) { DCHECK_EQ(CONTENT_SETTINGS_TYPE_COOKIES, content_type); set_custom_link_enabled(true); } @@ -360,18 +360,18 @@ class ContentSettingCookiesBubbleModel : public ContentSettingSingleRadioGroup { content::Source<TabSpecificContentSettings>( tab_contents()->content_settings()), content::NotificationService::NoDetails()); - browser()->ShowCollectedCookiesDialog(tab_contents()); + delegate()->ShowCollectedCookiesDialog(tab_contents()); } }; class ContentSettingPluginBubbleModel : public ContentSettingSingleRadioGroup { public: - ContentSettingPluginBubbleModel(Browser* browser, + ContentSettingPluginBubbleModel(Delegate* delegate, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type) : ContentSettingSingleRadioGroup( - browser, tab_contents, profile, content_type) { + delegate, tab_contents, profile, content_type) { DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS); set_custom_link_enabled(tab_contents && tab_contents->content_settings()-> load_plugins_link_enabled()); @@ -393,12 +393,12 @@ class ContentSettingPluginBubbleModel : public ContentSettingSingleRadioGroup { class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup { public: - ContentSettingPopupBubbleModel(Browser* browser, + ContentSettingPopupBubbleModel(Delegate* delegate, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type) : ContentSettingSingleRadioGroup( - browser, tab_contents, profile, content_type) { + delegate, tab_contents, profile, content_type) { SetPopups(); } @@ -435,12 +435,12 @@ class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup { class ContentSettingDomainListBubbleModel : public ContentSettingTitleAndLinkModel { public: - ContentSettingDomainListBubbleModel(Browser* browser, + ContentSettingDomainListBubbleModel(Delegate* delegate, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type) : ContentSettingTitleAndLinkModel( - browser, tab_contents, profile, content_type) { + delegate, tab_contents, profile, content_type) { DCHECK_EQ(CONTENT_SETTINGS_TYPE_GEOLOCATION, content_type) << "SetDomains currently only supports geolocation content type"; SetDomainsAndCustomLink(); @@ -511,27 +511,27 @@ class ContentSettingDomainListBubbleModel // static ContentSettingBubbleModel* ContentSettingBubbleModel::CreateContentSettingBubbleModel( - Browser* browser, + Delegate* delegate, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type) { if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) { - return new ContentSettingCookiesBubbleModel(browser, tab_contents, profile, + return new ContentSettingCookiesBubbleModel(delegate, tab_contents, profile, content_type); } if (content_type == CONTENT_SETTINGS_TYPE_POPUPS) { - return new ContentSettingPopupBubbleModel(browser, tab_contents, profile, + return new ContentSettingPopupBubbleModel(delegate, tab_contents, profile, content_type); } if (content_type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { - return new ContentSettingDomainListBubbleModel(browser, tab_contents, + return new ContentSettingDomainListBubbleModel(delegate, tab_contents, profile, content_type); } if (content_type == CONTENT_SETTINGS_TYPE_PLUGINS) { - return new ContentSettingPluginBubbleModel(browser, tab_contents, profile, + return new ContentSettingPluginBubbleModel(delegate, tab_contents, profile, content_type); } - return new ContentSettingSingleRadioGroup(browser, tab_contents, profile, + return new ContentSettingSingleRadioGroup(delegate, tab_contents, profile, content_type); } diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.h b/chrome/browser/ui/content_settings/content_setting_bubble_model.h index eabc97b..271efa4 100644 --- a/chrome/browser/ui/content_settings/content_setting_bubble_model.h +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,7 +17,7 @@ #include "googleurl/src/gurl.h" #include "third_party/skia/include/core/SkBitmap.h" -class Browser; +class ContentSettingBubbleModelDelegate; class Profile; class TabContentsWrapper; @@ -27,8 +27,10 @@ class ContentSettingBubbleModel : public content::NotificationObserver { public: virtual ~ContentSettingBubbleModel(); + typedef ContentSettingBubbleModelDelegate Delegate; + static ContentSettingBubbleModel* CreateContentSettingBubbleModel( - Browser* browser, + Delegate* delegate, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type); diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model_delegate.h b/chrome/browser/ui/content_settings/content_setting_bubble_model_delegate.h new file mode 100644 index 0000000..b1bb956 --- /dev/null +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model_delegate.h @@ -0,0 +1,26 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_DELEGATE_H_ +#define CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_DELEGATE_H_ +#pragma once + +#include "chrome/common/content_settings_types.h" + +class TabContentsWrapper; + +// Delegate which is used by ContentSettingBubbleModel class. +class ContentSettingBubbleModelDelegate { + public: + // Shows the cookies collected in the tab contents wrapper. + virtual void ShowCollectedCookiesDialog(TabContentsWrapper* contents) = 0; + + // Shows the Content Settings page for a given content type. + virtual void ShowContentSettingsPage(ContentSettingsType type) = 0; + + protected: + virtual ~ContentSettingBubbleModelDelegate() {} +}; + +#endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_DELEGATE_H_ diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index 9e8712d..5ffbded 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -32,6 +32,7 @@ #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" #include "chrome/browser/ui/content_settings/content_setting_image_model.h" @@ -1377,7 +1378,9 @@ gboolean LocationBarViewGtk::ContentSettingImageViewGtk::OnButtonPressed( content_setting_bubble_ = new ContentSettingBubbleGtk( sender, this, ContentSettingBubbleModel::CreateContentSettingBubbleModel( - parent_->browser(), tab_contents, profile, + parent_->browser()->content_setting_bubble_model_delegate(), + tab_contents, + profile, content_setting_image_model_->get_content_settings_type()), profile, tab_contents->web_contents()); return TRUE; diff --git a/chrome/browser/ui/toolbar/toolbar_model.cc b/chrome/browser/ui/toolbar/toolbar_model.cc index b769829..23afe521 100644 --- a/chrome/browser/ui/toolbar/toolbar_model.cc +++ b/chrome/browser/ui/toolbar/toolbar_model.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,7 +10,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ssl/ssl_error_info.h" -#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" @@ -32,8 +32,8 @@ using content::NavigationEntry; using content::SSLStatus; using content::WebContents; -ToolbarModel::ToolbarModel(Browser* browser) - : browser_(browser), +ToolbarModel::ToolbarModel(ToolbarModelDelegate* delegate) + : delegate_(delegate), input_in_progress_(false) { } @@ -84,7 +84,7 @@ bool ToolbarModel::ShouldDisplayURL() const { } } - WebContents* web_contents = browser_->GetSelectedWebContents(); + WebContents* web_contents = delegate_->GetActiveWebContents(); if (web_contents && web_contents->GetWebUIForCurrentState()) return !web_contents->GetWebUIForCurrentState()->ShouldHideURL(); @@ -174,6 +174,6 @@ NavigationController* ToolbarModel::GetNavigationController() const { // This |current_tab| can be NULL during the initialization of the // toolbar during window creation (i.e. before any tabs have been added // to the window). - WebContents* current_tab = browser_->GetSelectedWebContents(); + WebContents* current_tab = delegate_->GetActiveWebContents(); return current_tab ? ¤t_tab->GetController() : NULL; } diff --git a/chrome/browser/ui/toolbar/toolbar_model.h b/chrome/browser/ui/toolbar/toolbar_model.h index e15fed6..e880348 100644 --- a/chrome/browser/ui/toolbar/toolbar_model.h +++ b/chrome/browser/ui/toolbar/toolbar_model.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,7 +11,7 @@ #include "base/basictypes.h" #include "base/string16.h" -class Browser; +class ToolbarModelDelegate; namespace content { class NavigationController; @@ -39,7 +39,7 @@ class ToolbarModel { NUM_SECURITY_LEVELS, }; - explicit ToolbarModel(Browser* browser); + explicit ToolbarModel(ToolbarModelDelegate* delegate); ~ToolbarModel(); // Returns the text that should be displayed in the location bar. @@ -75,7 +75,7 @@ class ToolbarModel { // If this returns NULL, default values are used. content::NavigationController* GetNavigationController() const; - Browser* browser_; + ToolbarModelDelegate* delegate_; // Whether the text in the location bar is currently being edited. bool input_in_progress_; diff --git a/chrome/browser/ui/toolbar/toolbar_model_delegate.h b/chrome/browser/ui/toolbar/toolbar_model_delegate.h new file mode 100644 index 0000000..c45defb --- /dev/null +++ b/chrome/browser/ui/toolbar/toolbar_model_delegate.h @@ -0,0 +1,23 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_DELEGATE_H_ +#define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_DELEGATE_H_ +#pragma once + +namespace content { +class WebContents; +} + +// Delegate which is used by ToolbarModel class. +class ToolbarModelDelegate { + public: + // Returns active WebContents. + virtual content::WebContents* GetActiveWebContents() const = 0; + + protected: + virtual ~ToolbarModelDelegate() {} +}; + +#endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_MODEL_DELEGATE_H_ diff --git a/chrome/browser/ui/views/location_bar/click_handler.cc b/chrome/browser/ui/views/location_bar/click_handler.cc index 8f636ae..b646dfa 100644 --- a/chrome/browser/ui/views/location_bar/click_handler.cc +++ b/chrome/browser/ui/views/location_bar/click_handler.cc @@ -4,7 +4,6 @@ #include "chrome/browser/ui/views/location_bar/click_handler.h" -#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "content/public/browser/navigation_controller.h" @@ -39,6 +38,6 @@ void ClickHandler::OnMouseReleased(const views::MouseEvent& event) { return; } - Browser* browser = Browser::GetBrowserForController(&controller, NULL); - browser->ShowPageInfo(tab, nav_entry->GetURL(), nav_entry->GetSSL(), true); + location_bar_->delegate()->ShowPageInfo( + tab, nav_entry->GetURL(), nav_entry->GetSSL(), true); } diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc index cac6184..589471f 100644 --- a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc +++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc @@ -6,7 +6,6 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h" -#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" #include "chrome/browser/ui/content_settings/content_setting_image_model.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" @@ -178,10 +177,10 @@ void ContentSettingImageView::OnMouseReleased(const views::MouseEvent& event) { pause_animation_ = true; } - Profile* profile = parent_->browser()->profile(); + Profile* profile = parent_->profile(); ContentSettingBubbleContents* bubble = new ContentSettingBubbleContents( ContentSettingBubbleModel::CreateContentSettingBubbleModel( - parent_->browser(), + parent_->delegate()->GetContentSettingBubbleModelDelegate(), tab_contents, profile, content_setting_image_model_->get_content_settings_type()), @@ -189,7 +188,7 @@ void ContentSettingImageView::OnMouseReleased(const views::MouseEvent& event) { tab_contents->web_contents(), this, views::BubbleBorder::TOP_RIGHT); - bubble_widget_ = browser::CreateViewsBubble(bubble); + bubble_widget_ = parent_->delegate()->CreateViewsBubble(bubble); bubble_widget_->AddObserver(this); bubble->Show(); } diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index e9da292..98001cd 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -139,11 +139,13 @@ static const int kSelectedKeywordBackgroundImages[] = { // LocationBarView ----------------------------------------------------------- -LocationBarView::LocationBarView(Browser* browser, +LocationBarView::LocationBarView(Profile* profile, + CommandUpdater* command_updater, ToolbarModel* model, Delegate* delegate, Mode mode) - : browser_(browser), + : profile_(profile), + command_updater_(command_updater), model_(model), delegate_(delegate), disposition_(CURRENT_TAB), @@ -177,7 +179,7 @@ LocationBarView::LocationBarView(Browser* browser, } edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, - browser_->profile()->GetPrefs(), this); + profile_->GetPrefs(), this); } LocationBarView::~LocationBarView() { @@ -215,12 +217,11 @@ void LocationBarView::Init() { // URL edit field. // View container for URL edit field. - Profile* profile = browser_->profile(); location_entry_.reset(OmniboxView::CreateOmniboxView( this, model_, - profile, - browser_->command_updater(), + profile_, + command_updater_, mode_ == POPUP, this)); SetLocationEntryFocusable(true); @@ -230,12 +231,12 @@ void LocationBarView::Init() { selected_keyword_view_ = new SelectedKeywordView( kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER, - GetColor(ToolbarModel::NONE, TEXT), profile); + GetColor(ToolbarModel::NONE, TEXT), profile_); AddChildView(selected_keyword_view_); selected_keyword_view_->SetFont(font_); selected_keyword_view_->SetVisible(false); - keyword_hint_view_ = new KeywordHintView(profile); + keyword_hint_view_ = new KeywordHintView(profile_); AddChildView(keyword_hint_view_); keyword_hint_view_->SetVisible(false); keyword_hint_view_->SetFont(font_); @@ -250,18 +251,17 @@ void LocationBarView::Init() { // Hide the star and Chrome To Mobile icons in popups and in the app launcher. if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { - star_view_ = new StarView(browser_->command_updater()); + star_view_ = new StarView(command_updater_); AddChildView(star_view_); star_view_->SetVisible(true); // Also disable Chrome To Mobile for off-the-record and non-synced profiles. - Profile* profile = browser_->profile(); - if (!profile->IsOffTheRecord() && profile->IsSyncAccessible()) { + if (!profile_->IsOffTheRecord() && profile_->IsSyncAccessible()) { chrome_to_mobile_view_ = - new ChromeToMobileView(this, browser_->command_updater()); + new ChromeToMobileView(this, command_updater_); AddChildView(chrome_to_mobile_view_); ChromeToMobileService* service = - ChromeToMobileServiceFactory::GetForProfile(browser_->profile()); + ChromeToMobileServiceFactory::GetForProfile(profile_); service->RequestMobileListUpdate(); chrome_to_mobile_view_->SetVisible(!service->mobiles().empty()); } @@ -339,17 +339,15 @@ void LocationBarView::SetAnimationOffset(int offset) { void LocationBarView::Update(const WebContents* tab_for_state_restoring) { bool star_enabled = star_view_ && !model_->input_in_progress() && edit_bookmarks_enabled_.GetValue(); - CommandUpdater* command_updater = browser_->command_updater(); - command_updater->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); + command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); if (star_view_) star_view_->SetVisible(star_enabled); - Profile* profile = browser_->profile(); bool chrome_to_mobile_enabled = chrome_to_mobile_view_ && - !model_->input_in_progress() && profile->IsSyncAccessible() && - !ChromeToMobileServiceFactory::GetForProfile(profile)->mobiles().empty(); - command_updater->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, - chrome_to_mobile_enabled); + !model_->input_in_progress() && profile_->IsSyncAccessible() && + !ChromeToMobileServiceFactory::GetForProfile(profile_)->mobiles().empty(); + command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, + chrome_to_mobile_enabled); RefreshContentSettingViews(); RefreshPageActionViews(); @@ -443,15 +441,15 @@ void LocationBarView::SetStarToggled(bool on) { } void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { - browser::ShowBookmarkBubbleView(star_view_, browser_->profile(), url, + browser::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked); } void LocationBarView::ShowChromeToMobileBubble() { - ChromeToMobileServiceFactory::GetForProfile(browser_->profile())-> + ChromeToMobileServiceFactory::GetForProfile(profile_)-> RequestMobileListUpdate(); browser::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, - browser_->profile()); + profile_); } gfx::Point LocationBarView::GetLocationEntryOrigin() const { @@ -619,13 +617,13 @@ void LocationBarView::Layout() { if (show_selected_keyword) { if (selected_keyword_view_->keyword() != keyword) { selected_keyword_view_->SetKeyword(keyword); - Profile* profile = browser_->profile(); const TemplateURL* template_url = - TemplateURLServiceFactory::GetForProfile(profile)-> + TemplateURLServiceFactory::GetForProfile(profile_)-> GetTemplateURLForKeyword(keyword); if (template_url && template_url->IsExtensionKeyword()) { - const SkBitmap& bitmap = profile->GetExtensionService()->GetOmniboxIcon( - template_url->GetExtensionId()); + const SkBitmap& bitmap = + profile_->GetExtensionService()->GetOmniboxIcon( + template_url->GetExtensionId()); selected_keyword_view_->SetImage(bitmap); selected_keyword_view_->set_is_extension_icon(true); } else { @@ -886,16 +884,16 @@ void LocationBarView::OnAutocompleteAccept( transition_ = content::PageTransitionFromInt( transition | content::PAGE_TRANSITION_FROM_ADDRESS_BAR); - if (browser_->command_updater()) { + if (command_updater_) { if (!alternate_nav_url.is_valid()) { - browser_->command_updater()->ExecuteCommand(IDC_OPEN_CURRENT_URL); + command_updater_->ExecuteCommand(IDC_OPEN_CURRENT_URL); } else { AlternateNavURLFetcher* fetcher = new AlternateNavURLFetcher(alternate_nav_url); // The AlternateNavURLFetcher will listen for the pending navigation // notification that will be issued as a result of the "open URL." It // will automatically install itself into that navigation controller. - browser_->command_updater()->ExecuteCommand(IDC_OPEN_CURRENT_URL); + command_updater_->ExecuteCommand(IDC_OPEN_CURRENT_URL); if (fetcher->state() == AlternateNavURLFetcher::NOT_STARTED) { // I'm not sure this should be reachable, but I'm not also sure enough // that it shouldn't to stick in a NOTREACHED(). In any case, this is @@ -1002,7 +1000,7 @@ void LocationBarView::RefreshPageActionViews() { if (mode_ != NORMAL) return; - ExtensionService* service = browser_->profile()->GetExtensionService(); + ExtensionService* service = profile_->GetExtensionService(); if (!service) return; @@ -1033,7 +1031,7 @@ void LocationBarView::RefreshPageActionViews() { // inserted in left-to-right order for accessibility. for (int i = page_actions.size() - 1; i >= 0; --i) { page_action_views_[i] = new PageActionWithBadgeView( - new PageActionImageView(this, page_actions[i])); + delegate_->CreatePageActionImageView(this, page_actions[i])); page_action_views_[i]->SetVisible(false); AddChildViewAt(page_action_views_[i], GetIndexOf(view)); } @@ -1076,7 +1074,7 @@ void LocationBarView::OnMouseEvent(const views::MouseEvent& event, UINT msg) { void LocationBarView::ShowFirstRunBubbleInternal() { #if !defined(OS_CHROMEOS) // First run bubble doesn't make sense for Chrome OS. - FirstRunBubble::ShowBubble(browser_->profile(), location_icon_view_); + FirstRunBubble::ShowBubble(profile_, location_icon_view_); #endif } @@ -1166,7 +1164,7 @@ bool LocationBarView::CanStartDragForView(View* sender, void LocationBarView::ShowFirstRunBubble() { // Wait until search engines have loaded to show the first run bubble. TemplateURLService* url_service = - TemplateURLServiceFactory::GetForProfile(browser_->profile()); + TemplateURLServiceFactory::GetForProfile(profile_); if (!url_service->loaded()) { template_url_service_ = url_service; template_url_service_->AddObserver(this); diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h index 4781c21..15de386 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h @@ -32,8 +32,9 @@ #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h" #endif -class Browser; class ChromeToMobileView; +class CommandUpdater; +class ContentSettingBubbleModelDelegate; class ContentSettingImageView; class EVBubbleView; class ExtensionAction; @@ -42,11 +43,18 @@ class InstantController; class KeywordHintView; class LocationIconView; class PageActionWithBadgeView; +class PageActionImageView; +class Profile; class SelectedKeywordView; class StarView; class TabContentsWrapper; class TemplateURLService; +namespace views { +class BubbleDelegateView; +class Widget; +} + #if defined(OS_WIN) || defined(USE_AURA) class SuggestedTextView; #endif @@ -86,10 +94,32 @@ class LocationBarView : public LocationBar, // Returns the InstantController, or NULL if there isn't one. virtual InstantController* GetInstant() = 0; + // Creates Widget for the given delegate. + virtual views::Widget* CreateViewsBubble( + views::BubbleDelegateView* bubble_delegate) = 0; + + // Creates PageActionImageView. Caller gets an ownership. + virtual PageActionImageView* CreatePageActionImageView( + LocationBarView* owner, + ExtensionAction* action) = 0; + + // Returns ContentSettingBubbleModelDelegate. + virtual ContentSettingBubbleModelDelegate* + GetContentSettingBubbleModelDelegate() = 0; + + // Shows page information in the given web contents. + virtual void ShowPageInfo(content::WebContents* web_contents, + const GURL& url, + const content::SSLStatus& ssl, + bool show_history) = 0; + // Called by the location bar view when the user starts typing in the edit. // This forces our security style to be UNKNOWN for the duration of the // editing. virtual void OnInputInProgress(bool in_progress) = 0; + + protected: + virtual ~Delegate() {} }; enum ColorKind { @@ -112,10 +142,12 @@ class LocationBarView : public LocationBar, APP_LAUNCHER }; - LocationBarView(Browser* browser, + LocationBarView(Profile* profile, + CommandUpdater* command_updater, ToolbarModel* model, Delegate* delegate, Mode mode); + virtual ~LocationBarView(); void Init(); @@ -134,7 +166,11 @@ class LocationBarView : public LocationBar, // saved state that the tab holds. void Update(const content::WebContents* tab_for_state_restoring); - Browser* browser() const { return browser_; } + // Returns corresponding profile. + Profile* profile() const { return profile_; } + + // Returns the delegate. + Delegate* delegate() const { return delegate_; } // Sets |preview_enabled| for the PageAction View associated with this // |page_action|. If |preview_enabled| is true, the view will display the @@ -352,8 +388,11 @@ class LocationBarView : public LocationBar, // The Autocomplete Edit field. scoped_ptr<OmniboxView> location_entry_; - // The Browser object that corresponds to this View. - Browser* browser_; + // The profile which corresponds to this View. + Profile* profile_; + + // Command updater which corresponds to this View. + CommandUpdater* command_updater_; // The model. ToolbarModel* model_; diff --git a/chrome/browser/ui/views/location_bar/page_action_image_view.cc b/chrome/browser/ui/views/location_bar/page_action_image_view.cc index f275df8..ceaeb61 100644 --- a/chrome/browser/ui/views/location_bar/page_action_image_view.cc +++ b/chrome/browser/ui/views/location_bar/page_action_image_view.cc @@ -27,16 +27,17 @@ using content::WebContents; PageActionImageView::PageActionImageView(LocationBarView* owner, - ExtensionAction* page_action) + ExtensionAction* page_action, + Browser* browser) : owner_(owner), page_action_(page_action), + browser_(browser), ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)), current_tab_id_(-1), preview_enabled_(false), popup_(NULL) { - const Extension* extension = owner_->browser()->profile()-> - GetExtensionService()->GetExtensionById(page_action->extension_id(), - false); + const Extension* extension = owner_->profile()->GetExtensionService()-> + GetExtensionById(page_action->extension_id(), false); DCHECK(extension); // Load all the icons declared in the manifest. This is the contents of the @@ -55,7 +56,7 @@ PageActionImageView::PageActionImageView(LocationBarView* owner, registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, content::Source<Profile>( - owner_->browser()->profile()->GetOriginalProfile())); + owner_->profile()->GetOriginalProfile())); set_accessibility_focusable(true); @@ -105,13 +106,13 @@ void PageActionImageView::ExecuteAction(int button, popup_ = ExtensionPopup::ShowPopup( page_action_->GetPopupUrl(current_tab_id_), - owner_->browser(), + browser_, this, arrow_location, inspect_with_devtools); popup_->GetWidget()->AddObserver(this); } else { - Profile* profile = owner_->browser()->profile(); + Profile* profile = owner_->profile(); ExtensionService* service = profile->GetExtensionService(); service->browser_event_router()->PageActionExecuted( profile, page_action_->extension_id(), page_action_->id(), @@ -159,14 +160,13 @@ bool PageActionImageView::OnKeyPressed(const views::KeyEvent& event) { void PageActionImageView::ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture) { - const Extension* extension = owner_->browser()->profile()-> - GetExtensionService()->GetExtensionById(page_action()->extension_id(), - false); + const Extension* extension = owner_->profile()->GetExtensionService()-> + GetExtensionById(page_action()->extension_id(), false); if (!extension->ShowConfigureContextMenus()) return; scoped_refptr<ExtensionContextMenuModel> context_menu_model( - new ExtensionContextMenuModel(extension, owner_->browser(), this)); + new ExtensionContextMenuModel(extension, browser_, this)); views::MenuModelAdapter menu_model_adapter(context_menu_model.get()); menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu())); gfx::Point screen_loc; diff --git a/chrome/browser/ui/views/location_bar/page_action_image_view.h b/chrome/browser/ui/views/location_bar/page_action_image_view.h index 1390189..ef96d12 100644 --- a/chrome/browser/ui/views/location_bar/page_action_image_view.h +++ b/chrome/browser/ui/views/location_bar/page_action_image_view.h @@ -15,6 +15,7 @@ #include "chrome/browser/ui/views/extensions/extension_popup.h" #include "ui/views/controls/image_view.h" +class Browser; class LocationBarView; namespace content { @@ -33,7 +34,8 @@ class PageActionImageView : public views::ImageView, public content::NotificationObserver { public: PageActionImageView(LocationBarView* owner, - ExtensionAction* page_action); + ExtensionAction* page_action, + Browser* browser); virtual ~PageActionImageView(); ExtensionAction* page_action() { return page_action_; } @@ -91,6 +93,9 @@ class PageActionImageView : public views::ImageView, // us, it resides in the extension of this particular profile. ExtensionAction* page_action_; + // The corresponding browser. + Browser* browser_; + // A cache of bitmaps the page actions might need to show, mapped by path. typedef std::map<std::string, SkBitmap> PageActionMap; PageActionMap page_action_icons_; diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc index 3438ee3..edbb9c8 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc @@ -435,7 +435,7 @@ OmniboxViewWin::OmniboxViewWin(AutocompleteEditController* controller, bool popup_window_mode, views::View* location_bar) : model_(new AutocompleteEditModel(this, controller, - parent_view->browser()->profile())), + parent_view->profile())), popup_view_(new AutocompletePopupContentsView(parent_view->font(), this, model_.get(), location_bar)), diff --git a/chrome/browser/ui/views/reload_button.cc b/chrome/browser/ui/views/reload_button.cc index 34b7857..efb6b2b 100644 --- a/chrome/browser/ui/views/reload_button.cc +++ b/chrome/browser/ui/views/reload_button.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,7 +6,7 @@ #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" -#include "chrome/browser/ui/browser.h" +#include "chrome/browser/command_updater.h" #include "chrome/browser/ui/views/event_utils.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "grit/generated_resources.h" @@ -19,10 +19,11 @@ const char ReloadButton::kViewClassName[] = "browser/ui/views/ReloadButton"; //////////////////////////////////////////////////////////////////////////////// // ReloadButton, public: -ReloadButton::ReloadButton(LocationBarView* location_bar, Browser* browser) +ReloadButton::ReloadButton(LocationBarView* location_bar, + CommandUpdater* command_updater) : ALLOW_THIS_IN_INITIALIZER_LIST(ToggleImageButton(this)), location_bar_(location_bar), - browser_(browser), + command_updater_(command_updater), intended_mode_(MODE_RELOAD), visible_mode_(MODE_RELOAD), double_click_timer_delay_( @@ -72,16 +73,14 @@ void ReloadButton::ChangeMode(Mode mode, bool force) { void ReloadButton::ButtonPressed(views::Button* /* button */, const views::Event& event) { if (visible_mode_ == MODE_STOP) { - if (browser_) - browser_->Stop(); + if (command_updater_) + command_updater_->ExecuteCommandWithDisposition(IDC_STOP, CURRENT_TAB); // The user has clicked, so we can feel free to update the button, // even if the mouse is still hovering. ChangeMode(MODE_RELOAD, true); } else if (!double_click_timer_.IsRunning()) { // Shift-clicking or ctrl-clicking the reload button means we should ignore // any cached content. - // TODO(avayvod): eliminate duplication of this logic in - // CompactLocationBarView. int command; int flags = mouse_event_flags(); if (event.IsShiftDown() || event.IsControlDown()) { @@ -109,8 +108,8 @@ void ReloadButton::ButtonPressed(views::Button* /* button */, double_click_timer_.Start(FROM_HERE, double_click_timer_delay_, this, &ReloadButton::OnDoubleClickTimer); - if (browser_) - browser_->ExecuteCommandWithDisposition(command, disposition); + if (command_updater_) + command_updater_->ExecuteCommandWithDisposition(command, disposition); ++testing_reload_count_; } } diff --git a/chrome/browser/ui/views/reload_button.h b/chrome/browser/ui/views/reload_button.h index 7de8245..3aee697 100644 --- a/chrome/browser/ui/views/reload_button.h +++ b/chrome/browser/ui/views/reload_button.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,7 +11,7 @@ #include "base/timer.h" #include "ui/views/controls/button/image_button.h" -class Browser; +class CommandUpdater; class LocationBarView; //////////////////////////////////////////////////////////////////////////////// @@ -33,7 +33,7 @@ class ReloadButton : public views::ToggleImageButton, // The button's class name. static const char kViewClassName[]; - ReloadButton(LocationBarView* location_bar, Browser* Browser); + ReloadButton(LocationBarView* location_bar, CommandUpdater* command_updater); virtual ~ReloadButton(); // Ask for a specified button state. If |force| is true this will be applied @@ -61,7 +61,7 @@ class ReloadButton : public views::ToggleImageButton, // These may be NULL when testing. LocationBarView* location_bar_; - Browser* browser_; + CommandUpdater* command_updater_; // The mode we should be in assuming no timers are running. Mode intended_mode_; diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index 575bc1a..61c629ca 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -10,6 +10,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/global_error_service.h" #include "chrome/browser/ui/global_error_service_factory.h" @@ -17,6 +18,7 @@ #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/browser_actions_container.h" #include "chrome/browser/ui/views/event_utils.h" +#include "chrome/browser/ui/views/location_bar/page_action_image_view.h" #include "chrome/browser/ui/views/window.h" #include "chrome/browser/ui/views/wrench_menu.h" #include "chrome/browser/upgrade_detector.h" @@ -169,11 +171,15 @@ void ToolbarView::Init() { forward_->set_id(VIEW_ID_FORWARD_BUTTON); // Have to create this before |reload_| as |reload_|'s constructor needs it. - location_bar_ = new LocationBarView(browser_, model_, this, + location_bar_ = new LocationBarView( + browser_->profile(), + browser_->command_updater(), + model_, + this, (display_mode_ == DISPLAYMODE_LOCATION) ? LocationBarView::POPUP : LocationBarView::NORMAL); - reload_ = new ReloadButton(location_bar_, browser_); + reload_ = new ReloadButton(location_bar_, browser_->command_updater()); reload_->set_triggerable_event_flags(ui::EF_LEFT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON); reload_->set_tag(IDC_RELOAD); @@ -366,6 +372,28 @@ InstantController* ToolbarView::GetInstant() { return browser_->instant(); } +ContentSettingBubbleModelDelegate* +ToolbarView::GetContentSettingBubbleModelDelegate() { + return browser_->content_setting_bubble_model_delegate(); +} + +void ToolbarView::ShowPageInfo(content::WebContents* web_contents, + const GURL& url, + const content::SSLStatus& ssl, + bool show_history) { + browser_->ShowPageInfo(web_contents, url, ssl, show_history); +} + +views::Widget* ToolbarView::CreateViewsBubble( + views::BubbleDelegateView* bubble_delegate) { + return browser::CreateViewsBubble(bubble_delegate); +} + +PageActionImageView* ToolbarView::CreatePageActionImageView( + LocationBarView* owner, ExtensionAction* action) { + return new PageActionImageView(owner, action, browser_); +} + void ToolbarView::OnInputInProgress(bool in_progress) { // The edit should make sure we're only notified when something changes. DCHECK(model_->input_in_progress() != in_progress); diff --git a/chrome/browser/ui/views/toolbar_view.h b/chrome/browser/ui/views/toolbar_view.h index fbaa688..4d044bd 100644 --- a/chrome/browser/ui/views/toolbar_view.h +++ b/chrome/browser/ui/views/toolbar_view.h @@ -93,6 +93,16 @@ class ToolbarView : public views::AccessiblePaneView, // Overridden from LocationBarView::Delegate: virtual TabContentsWrapper* GetTabContentsWrapper() const OVERRIDE; virtual InstantController* GetInstant() OVERRIDE; + virtual views::Widget* CreateViewsBubble( + views::BubbleDelegateView* bubble_delegate) OVERRIDE; + virtual PageActionImageView* CreatePageActionImageView( + LocationBarView* owner, ExtensionAction* action) OVERRIDE; + virtual ContentSettingBubbleModelDelegate* + GetContentSettingBubbleModelDelegate() OVERRIDE; + virtual void ShowPageInfo(content::WebContents* web_contents, + const GURL& url, + const content::SSLStatus& ssl, + bool show_history) OVERRIDE; virtual void OnInputInProgress(bool in_progress) OVERRIDE; // Overridden from CommandUpdater::CommandObserver: diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index ca71f3e..edca885 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2317,6 +2317,10 @@ 'browser/ui/browser_list_win.cc', 'browser/ui/browser_navigator.cc', 'browser/ui/browser_navigator.h', + 'browser/ui/browser_content_setting_bubble_model_delegate.cc', + 'browser/ui/browser_content_setting_bubble_model_delegate.h', + 'browser/ui/browser_toolbar_model_delegate.cc', + 'browser/ui/browser_toolbar_model_delegate.h', 'browser/ui/browser_tab_restore_service_delegate.cc', 'browser/ui/browser_tab_restore_service_delegate.h', 'browser/ui/browser_window.h', @@ -2770,6 +2774,7 @@ 'browser/ui/confirm_bubble_model.h', 'browser/ui/content_settings/content_setting_bubble_model.cc', 'browser/ui/content_settings/content_setting_bubble_model.h', + 'browser/ui/content_settings/content_setting_bubble_model_delegate.h', 'browser/ui/content_settings/content_setting_image_model.cc', 'browser/ui/content_settings/content_setting_image_model.h', 'browser/ui/constrained_window.cc', @@ -3180,6 +3185,7 @@ 'browser/ui/toolbar/encoding_menu_controller.h', 'browser/ui/toolbar/toolbar_model.cc', 'browser/ui/toolbar/toolbar_model.h', + 'browser/ui/toolbar/toolbar_model_delegate.h', 'browser/ui/toolbar/wrench_menu_model.cc', 'browser/ui/toolbar/wrench_menu_model.h', 'browser/ui/toolbar/wrench_menu_model_chromeos.cc', |