From db6a876afe73ed1ad3befa04d0612527222ac168 Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Fri, 16 Mar 2012 02:15:25 +0000 Subject: Revert 126959 - 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 Review URL: http://codereview.chromium.org/9479008 TBR=altimofeev@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127083 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/command_updater.cc | 10 +- chrome/browser/command_updater.h | 20 +- chrome/browser/command_updater_unittest.cc | 6 +- chrome/browser/sync/sync_global_error_unittest.cc | 9 +- chrome/browser/ui/browser.cc | 233 ++++++++++----------- chrome/browser/ui/browser.h | 25 +-- ...rowser_content_setting_bubble_model_delegate.cc | 25 --- ...browser_content_setting_bubble_model_delegate.h | 34 --- .../browser/ui/browser_toolbar_model_delegate.cc | 19 -- chrome/browser/ui/browser_toolbar_model_delegate.h | 31 --- .../location_bar/content_setting_decoration.mm | 6 +- .../ui/cocoa/location_bar/location_bar_view_mac.h | 1 - .../content_setting_bubble_model.cc | 52 ++--- .../content_setting_bubble_model.h | 8 +- .../content_setting_bubble_model_delegate.h | 26 --- chrome/browser/ui/gtk/location_bar_view_gtk.cc | 5 +- chrome/browser/ui/toolbar/toolbar_model.cc | 12 +- chrome/browser/ui/toolbar/toolbar_model.h | 8 +- chrome/browser/ui/toolbar/toolbar_model_delegate.h | 23 -- .../browser/ui/views/location_bar/click_handler.cc | 5 +- .../location_bar/content_setting_image_view.cc | 7 +- .../ui/views/location_bar/location_bar_view.cc | 66 +++--- .../ui/views/location_bar/location_bar_view.h | 49 +---- .../views/location_bar/page_action_image_view.cc | 22 +- .../ui/views/location_bar/page_action_image_view.h | 7 +- .../browser/ui/views/omnibox/omnibox_view_win.cc | 2 +- chrome/browser/ui/views/reload_button.cc | 19 +- chrome/browser/ui/views/reload_button.h | 8 +- chrome/browser/ui/views/toolbar_view.cc | 32 +-- chrome/browser/ui/views/toolbar_view.h | 10 - chrome/chrome_browser.gypi | 6 - 31 files changed, 245 insertions(+), 541 deletions(-) delete mode 100644 chrome/browser/ui/browser_content_setting_bubble_model_delegate.cc delete mode 100644 chrome/browser/ui/browser_content_setting_bubble_model_delegate.h delete mode 100644 chrome/browser/ui/browser_toolbar_model_delegate.cc delete mode 100644 chrome/browser/ui/browser_toolbar_model_delegate.h delete mode 100644 chrome/browser/ui/content_settings/content_setting_bubble_model_delegate.h delete mode 100644 chrome/browser/ui/toolbar/toolbar_model_delegate.h diff --git a/chrome/browser/command_updater.cc b/chrome/browser/command_updater.cc index 3642db4..4a1b0db 100644 --- a/chrome/browser/command_updater.cc +++ b/chrome/browser/command_updater.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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,14 +41,8 @@ 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_->ExecuteCommandWithDisposition(id, disposition); + delegate_->ExecuteCommand(id); } CommandUpdater::CommandObserver::~CommandObserver() { diff --git a/chrome/browser/command_updater.h b/chrome/browser/command_updater.h index 80d8350..024658d 100644 --- a/chrome/browser/command_updater.h +++ b/chrome/browser/command_updater.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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,7 +8,6 @@ #include "base/basictypes.h" #include "base/hash_tables.h" -#include "webkit/glue/window_open_disposition.h" //////////////////////////////////////////////////////////////////////////////// // @@ -24,11 +23,8 @@ class CommandUpdater { // when needed. class CommandUpdaterDelegate { public: - // Performs the action associated with the command with the specified ID and - // using the given disposition. - virtual void ExecuteCommandWithDisposition( - int id, - WindowOpenDisposition disposition) = 0; + // Perform the action associated with the command with the specified ID. + virtual void ExecuteCommand(int id) = 0; protected: virtual ~CommandUpdaterDelegate(); @@ -46,19 +42,11 @@ class CommandUpdater { // supported by this updater. bool IsCommandEnabled(int id) const; - // Performs the action associated with this command ID using CURRENT_TAB - // disposition. + // Performs the action associated with this command ID. // 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 5dcc737..659e3c6 100644 --- a/chrome/browser/command_updater_unittest.cc +++ b/chrome/browser/command_updater_unittest.cc @@ -1,16 +1,14 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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 ExecuteCommandWithDisposition(int id, - WindowOpenDisposition) OVERRIDE { + virtual void ExecuteCommand(int id) { 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 0f7943e..7405def 100644 --- a/chrome/browser/sync/sync_global_error_unittest.cc +++ b/chrome/browser/sync/sync_global_error_unittest.cc @@ -17,10 +17,9 @@ #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::_; +using ::testing::NiceMock; using content::BrowserThread; namespace { @@ -29,8 +28,7 @@ class BrowserMock: public Browser { public: explicit BrowserMock(Type type, Profile* profile) : Browser(type, profile) {} - MOCK_METHOD2(ExecuteCommandWithDisposition, - void(int command_id, WindowOpenDisposition)); + MOCK_METHOD1(ExecuteCommand, void(int command_id)); }; // Same as BrowserWithTestWindowTest, but uses MockBrowser to test calls to @@ -89,8 +87,7 @@ void VerifySyncGlobalErrorResult(NiceMock* 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(browser), - ExecuteCommandWithDisposition(IDC_EXIT, _)); + EXPECT_CALL(*static_cast(browser), ExecuteCommand(IDC_EXIT)); error->ExecuteMenuItem(browser); } #else diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index c9a3a896..fc2d058 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -103,12 +103,10 @@ #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" @@ -341,6 +339,7 @@ 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), @@ -352,12 +351,6 @@ 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( @@ -365,8 +358,6 @@ 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, @@ -1871,7 +1862,7 @@ void Browser::WriteCurrentURLToClipboard() { // RenderContextViewMenu. WebContents* contents = GetSelectedWebContents(); - if (!toolbar_model_->ShouldDisplayURL()) + if (!toolbar_model_.ShouldDisplayURL()) return; chrome_browser_net::WriteURLToClipboard( @@ -2925,115 +2916,6 @@ 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, CURRENT_TAB); - 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(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. @@ -3232,6 +3114,115 @@ 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(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: @@ -4891,7 +4882,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 b27c809..3c13726 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -52,9 +52,7 @@ #include "ui/base/ui_base_types.h" #include "ui/gfx/rect.h" -class BrowserContentSettingBubbleModelDelegate; class BrowserSyncedWindowDelegate; -class BrowserToolbarModelDelegate; class BrowserTabRestoreServiceDelegate; class BrowserWindow; class Extension; @@ -236,14 +234,10 @@ 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_.get(); } + ToolbarModel* toolbar_model() { return &toolbar_model_; } 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(); } @@ -755,8 +749,8 @@ class Browser : public TabHandlerDelegate, static void UpdateTargetURLHelper(content::WebContents* tab, int32 page_id, const GURL& url); - // Calls ExecuteCommandWithDisposition with CURRENT_TAB disposition. - void ExecuteCommand(int id); + // Calls ExecuteCommandWithDisposition with the given disposition. + void ExecuteCommandWithDisposition(int id, WindowOpenDisposition); // Calls ExecuteCommandWithDisposition with the given event flags. void ExecuteCommand(int id, int event_flags); @@ -799,9 +793,7 @@ class Browser : public TabHandlerDelegate, const content::OpenURLParams& params) OVERRIDE; // Overridden from CommandUpdater::CommandUpdaterDelegate: - virtual void ExecuteCommandWithDisposition( - int id, - WindowOpenDisposition disposition) OVERRIDE; + virtual void ExecuteCommand(int id) OVERRIDE; // Overridden from TabRestoreServiceObserver: virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE; @@ -1370,7 +1362,7 @@ class Browser : public TabHandlerDelegate, const SessionID session_id_; // The model for the toolbar view. - scoped_ptr toolbar_model_; + ToolbarModel toolbar_model_; // UI update coalescing and handling //////////////////////////////////////// @@ -1464,13 +1456,6 @@ class Browser : public TabHandlerDelegate, // and we install ourselves as an observer. TabRestoreService* tab_restore_service_; - // Helper which implements the ContentSettingBubbleModel interface. - scoped_ptr - content_setting_bubble_model_delegate_; - - // Helper which implements the ToolbarModelDelegate interface. - scoped_ptr toolbar_model_delegate_; - // Helper which implements the TabRestoreServiceDelegate interface. scoped_ptr 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 deleted file mode 100644 index 983f5e2..0000000 --- a/chrome/browser/ui/browser_content_setting_bubble_model_delegate.cc +++ /dev/null @@ -1,25 +0,0 @@ -// 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 deleted file mode 100644 index c9e3542..0000000 --- a/chrome/browser/ui/browser_content_setting_bubble_model_delegate.h +++ /dev/null @@ -1,34 +0,0 @@ -// 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 deleted file mode 100644 index e93f33b..0000000 --- a/chrome/browser/ui/browser_toolbar_model_delegate.cc +++ /dev/null @@ -1,19 +0,0 @@ -// 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 deleted file mode 100644 index dd38ba1f..0000000 --- a/chrome/browser/ui/browser_toolbar_model_delegate.h +++ /dev/null @@ -1,31 +0,0 @@ -// 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 47610c7..d0f17a7 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) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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,6 @@ #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" @@ -279,8 +278,7 @@ bool ContentSettingDecoration::OnMousePressed(NSRect frame) { // Open bubble. ContentSettingBubbleModel* model = ContentSettingBubbleModel::CreateContentSettingBubbleModel( - browser->content_setting_bubble_model_delegate(), - tabContents, profile_, + browser, 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 f61e679..aa6d19f 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,7 +17,6 @@ #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 4978542..ad7398e 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(Delegate* delegate, + ContentSettingTitleAndLinkModel(Browser* browser, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type) : ContentSettingBubbleModel(tab_contents, profile, content_type), - delegate_(delegate) { + browser_(browser) { // 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() {} - Delegate* delegate() const { return delegate_; } + Browser* browser() const { return browser_; } private: void SetBlockedResources() { @@ -131,22 +131,22 @@ class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel { } virtual void OnManageLinkClicked() { - if (delegate_) - delegate_->ShowContentSettingsPage(content_type()); + if (browser_) + browser_->ShowContentSettingsPage(content_type()); } - Delegate* delegate_; + Browser* browser_; }; class ContentSettingTitleLinkAndCustomModel : public ContentSettingTitleAndLinkModel { public: - ContentSettingTitleLinkAndCustomModel(Delegate* delegate, + ContentSettingTitleLinkAndCustomModel(Browser* browser, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type) : ContentSettingTitleAndLinkModel( - delegate, tab_contents, profile, content_type) { + browser, tab_contents, profile, content_type) { SetCustomLink(); } @@ -171,11 +171,11 @@ class ContentSettingTitleLinkAndCustomModel class ContentSettingSingleRadioGroup : public ContentSettingTitleLinkAndCustomModel { public: - ContentSettingSingleRadioGroup(Delegate* delegate, + ContentSettingSingleRadioGroup(Browser* browser, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type) - : ContentSettingTitleLinkAndCustomModel(delegate, tab_contents, profile, + : ContentSettingTitleLinkAndCustomModel(browser, 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(Delegate* delegate, + ContentSettingCookiesBubbleModel(Browser* browser, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type) : ContentSettingSingleRadioGroup( - delegate, tab_contents, profile, content_type) { + browser, 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( tab_contents()->content_settings()), content::NotificationService::NoDetails()); - delegate()->ShowCollectedCookiesDialog(tab_contents()); + browser()->ShowCollectedCookiesDialog(tab_contents()); } }; class ContentSettingPluginBubbleModel : public ContentSettingSingleRadioGroup { public: - ContentSettingPluginBubbleModel(Delegate* delegate, + ContentSettingPluginBubbleModel(Browser* browser, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type) : ContentSettingSingleRadioGroup( - delegate, tab_contents, profile, content_type) { + browser, 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(Delegate* delegate, + ContentSettingPopupBubbleModel(Browser* browser, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type) : ContentSettingSingleRadioGroup( - delegate, tab_contents, profile, content_type) { + browser, tab_contents, profile, content_type) { SetPopups(); } @@ -435,12 +435,12 @@ class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup { class ContentSettingDomainListBubbleModel : public ContentSettingTitleAndLinkModel { public: - ContentSettingDomainListBubbleModel(Delegate* delegate, + ContentSettingDomainListBubbleModel(Browser* browser, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type) : ContentSettingTitleAndLinkModel( - delegate, tab_contents, profile, content_type) { + browser, 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( - Delegate* delegate, + Browser* browser, TabContentsWrapper* tab_contents, Profile* profile, ContentSettingsType content_type) { if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) { - return new ContentSettingCookiesBubbleModel(delegate, tab_contents, profile, + return new ContentSettingCookiesBubbleModel(browser, tab_contents, profile, content_type); } if (content_type == CONTENT_SETTINGS_TYPE_POPUPS) { - return new ContentSettingPopupBubbleModel(delegate, tab_contents, profile, + return new ContentSettingPopupBubbleModel(browser, tab_contents, profile, content_type); } if (content_type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { - return new ContentSettingDomainListBubbleModel(delegate, tab_contents, + return new ContentSettingDomainListBubbleModel(browser, tab_contents, profile, content_type); } if (content_type == CONTENT_SETTINGS_TYPE_PLUGINS) { - return new ContentSettingPluginBubbleModel(delegate, tab_contents, profile, + return new ContentSettingPluginBubbleModel(browser, tab_contents, profile, content_type); } - return new ContentSettingSingleRadioGroup(delegate, tab_contents, profile, + return new ContentSettingSingleRadioGroup(browser, 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 271efa4..eabc97b 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) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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 ContentSettingBubbleModelDelegate; +class Browser; class Profile; class TabContentsWrapper; @@ -27,10 +27,8 @@ class ContentSettingBubbleModel : public content::NotificationObserver { public: virtual ~ContentSettingBubbleModel(); - typedef ContentSettingBubbleModelDelegate Delegate; - static ContentSettingBubbleModel* CreateContentSettingBubbleModel( - Delegate* delegate, + Browser* browser, 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 deleted file mode 100644 index b1bb956..0000000 --- a/chrome/browser/ui/content_settings/content_setting_bubble_model_delegate.h +++ /dev/null @@ -1,26 +0,0 @@ -// 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 5ffbded..9e8712d 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -32,7 +32,6 @@ #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" @@ -1378,9 +1377,7 @@ gboolean LocationBarViewGtk::ContentSettingImageViewGtk::OnButtonPressed( content_setting_bubble_ = new ContentSettingBubbleGtk( sender, this, ContentSettingBubbleModel::CreateContentSettingBubbleModel( - parent_->browser()->content_setting_bubble_model_delegate(), - tab_contents, - profile, + parent_->browser(), 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 23afe521..b769829 100644 --- a/chrome/browser/ui/toolbar/toolbar_model.cc +++ b/chrome/browser/ui/toolbar/toolbar_model.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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/toolbar/toolbar_model_delegate.h" +#include "chrome/browser/ui/browser.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(ToolbarModelDelegate* delegate) - : delegate_(delegate), +ToolbarModel::ToolbarModel(Browser* browser) + : browser_(browser), input_in_progress_(false) { } @@ -84,7 +84,7 @@ bool ToolbarModel::ShouldDisplayURL() const { } } - WebContents* web_contents = delegate_->GetActiveWebContents(); + WebContents* web_contents = browser_->GetSelectedWebContents(); 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 = delegate_->GetActiveWebContents(); + WebContents* current_tab = browser_->GetSelectedWebContents(); 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 e880348..e15fed6 100644 --- a/chrome/browser/ui/toolbar/toolbar_model.h +++ b/chrome/browser/ui/toolbar/toolbar_model.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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 ToolbarModelDelegate; +class Browser; namespace content { class NavigationController; @@ -39,7 +39,7 @@ class ToolbarModel { NUM_SECURITY_LEVELS, }; - explicit ToolbarModel(ToolbarModelDelegate* delegate); + explicit ToolbarModel(Browser* browser); ~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; - ToolbarModelDelegate* delegate_; + Browser* browser_; // 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 deleted file mode 100644 index c45defb..0000000 --- a/chrome/browser/ui/toolbar/toolbar_model_delegate.h +++ /dev/null @@ -1,23 +0,0 @@ -// 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 b646dfa..8f636ae 100644 --- a/chrome/browser/ui/views/location_bar/click_handler.cc +++ b/chrome/browser/ui/views/location_bar/click_handler.cc @@ -4,6 +4,7 @@ #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" @@ -38,6 +39,6 @@ void ClickHandler::OnMouseReleased(const views::MouseEvent& event) { return; } - location_bar_->delegate()->ShowPageInfo( - tab, nav_entry->GetURL(), nav_entry->GetSSL(), true); + Browser* browser = Browser::GetBrowserForController(&controller, NULL); + browser->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 589471f..cac6184 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,6 +6,7 @@ #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" @@ -177,10 +178,10 @@ void ContentSettingImageView::OnMouseReleased(const views::MouseEvent& event) { pause_animation_ = true; } - Profile* profile = parent_->profile(); + Profile* profile = parent_->browser()->profile(); ContentSettingBubbleContents* bubble = new ContentSettingBubbleContents( ContentSettingBubbleModel::CreateContentSettingBubbleModel( - parent_->delegate()->GetContentSettingBubbleModelDelegate(), + parent_->browser(), tab_contents, profile, content_setting_image_model_->get_content_settings_type()), @@ -188,7 +189,7 @@ void ContentSettingImageView::OnMouseReleased(const views::MouseEvent& event) { tab_contents->web_contents(), this, views::BubbleBorder::TOP_RIGHT); - bubble_widget_ = parent_->delegate()->CreateViewsBubble(bubble); + bubble_widget_ = browser::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 98001cd..e9da292 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -139,13 +139,11 @@ static const int kSelectedKeywordBackgroundImages[] = { // LocationBarView ----------------------------------------------------------- -LocationBarView::LocationBarView(Profile* profile, - CommandUpdater* command_updater, +LocationBarView::LocationBarView(Browser* browser, ToolbarModel* model, Delegate* delegate, Mode mode) - : profile_(profile), - command_updater_(command_updater), + : browser_(browser), model_(model), delegate_(delegate), disposition_(CURRENT_TAB), @@ -179,7 +177,7 @@ LocationBarView::LocationBarView(Profile* profile, } edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, - profile_->GetPrefs(), this); + browser_->profile()->GetPrefs(), this); } LocationBarView::~LocationBarView() { @@ -217,11 +215,12 @@ void LocationBarView::Init() { // URL edit field. // View container for URL edit field. + Profile* profile = browser_->profile(); location_entry_.reset(OmniboxView::CreateOmniboxView( this, model_, - profile_, - command_updater_, + profile, + browser_->command_updater(), mode_ == POPUP, this)); SetLocationEntryFocusable(true); @@ -231,12 +230,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_); @@ -251,17 +250,18 @@ 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(command_updater_); + star_view_ = new StarView(browser_->command_updater()); AddChildView(star_view_); star_view_->SetVisible(true); // Also disable Chrome To Mobile for off-the-record and non-synced profiles. - if (!profile_->IsOffTheRecord() && profile_->IsSyncAccessible()) { + Profile* profile = browser_->profile(); + if (!profile->IsOffTheRecord() && profile->IsSyncAccessible()) { chrome_to_mobile_view_ = - new ChromeToMobileView(this, command_updater_); + new ChromeToMobileView(this, browser_->command_updater()); AddChildView(chrome_to_mobile_view_); ChromeToMobileService* service = - ChromeToMobileServiceFactory::GetForProfile(profile_); + ChromeToMobileServiceFactory::GetForProfile(browser_->profile()); service->RequestMobileListUpdate(); chrome_to_mobile_view_->SetVisible(!service->mobiles().empty()); } @@ -339,15 +339,17 @@ 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(); - command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); + CommandUpdater* command_updater = browser_->command_updater(); + 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(); @@ -441,15 +443,15 @@ void LocationBarView::SetStarToggled(bool on) { } void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { - browser::ShowBookmarkBubbleView(star_view_, profile_, url, + browser::ShowBookmarkBubbleView(star_view_, browser_->profile(), url, newly_bookmarked); } void LocationBarView::ShowChromeToMobileBubble() { - ChromeToMobileServiceFactory::GetForProfile(profile_)-> + ChromeToMobileServiceFactory::GetForProfile(browser_->profile())-> RequestMobileListUpdate(); browser::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, - profile_); + browser_->profile()); } gfx::Point LocationBarView::GetLocationEntryOrigin() const { @@ -617,13 +619,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 { @@ -884,16 +886,16 @@ void LocationBarView::OnAutocompleteAccept( transition_ = content::PageTransitionFromInt( transition | content::PAGE_TRANSITION_FROM_ADDRESS_BAR); - if (command_updater_) { + if (browser_->command_updater()) { if (!alternate_nav_url.is_valid()) { - command_updater_->ExecuteCommand(IDC_OPEN_CURRENT_URL); + browser_->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. - command_updater_->ExecuteCommand(IDC_OPEN_CURRENT_URL); + browser_->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 @@ -1000,7 +1002,7 @@ void LocationBarView::RefreshPageActionViews() { if (mode_ != NORMAL) return; - ExtensionService* service = profile_->GetExtensionService(); + ExtensionService* service = browser_->profile()->GetExtensionService(); if (!service) return; @@ -1031,7 +1033,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( - delegate_->CreatePageActionImageView(this, page_actions[i])); + new PageActionImageView(this, page_actions[i])); page_action_views_[i]->SetVisible(false); AddChildViewAt(page_action_views_[i], GetIndexOf(view)); } @@ -1074,7 +1076,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(profile_, location_icon_view_); + FirstRunBubble::ShowBubble(browser_->profile(), location_icon_view_); #endif } @@ -1164,7 +1166,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(profile_); + TemplateURLServiceFactory::GetForProfile(browser_->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 15de386..4781c21 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h @@ -32,9 +32,8 @@ #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; @@ -43,18 +42,11 @@ 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 @@ -94,32 +86,10 @@ 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 { @@ -142,12 +112,10 @@ class LocationBarView : public LocationBar, APP_LAUNCHER }; - LocationBarView(Profile* profile, - CommandUpdater* command_updater, + LocationBarView(Browser* browser, ToolbarModel* model, Delegate* delegate, Mode mode); - virtual ~LocationBarView(); void Init(); @@ -166,11 +134,7 @@ class LocationBarView : public LocationBar, // saved state that the tab holds. void Update(const content::WebContents* tab_for_state_restoring); - // Returns corresponding profile. - Profile* profile() const { return profile_; } - - // Returns the delegate. - Delegate* delegate() const { return delegate_; } + Browser* browser() const { return browser_; } // Sets |preview_enabled| for the PageAction View associated with this // |page_action|. If |preview_enabled| is true, the view will display the @@ -388,11 +352,8 @@ class LocationBarView : public LocationBar, // The Autocomplete Edit field. scoped_ptr location_entry_; - // The profile which corresponds to this View. - Profile* profile_; - - // Command updater which corresponds to this View. - CommandUpdater* command_updater_; + // The Browser object that corresponds to this View. + Browser* browser_; // 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 ceaeb61..f275df8 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,17 +27,16 @@ using content::WebContents; PageActionImageView::PageActionImageView(LocationBarView* owner, - ExtensionAction* page_action, - Browser* browser) + ExtensionAction* page_action) : 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_->profile()->GetExtensionService()-> - GetExtensionById(page_action->extension_id(), false); + const Extension* extension = owner_->browser()->profile()-> + GetExtensionService()->GetExtensionById(page_action->extension_id(), + false); DCHECK(extension); // Load all the icons declared in the manifest. This is the contents of the @@ -56,7 +55,7 @@ PageActionImageView::PageActionImageView(LocationBarView* owner, registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, content::Source( - owner_->profile()->GetOriginalProfile())); + owner_->browser()->profile()->GetOriginalProfile())); set_accessibility_focusable(true); @@ -106,13 +105,13 @@ void PageActionImageView::ExecuteAction(int button, popup_ = ExtensionPopup::ShowPopup( page_action_->GetPopupUrl(current_tab_id_), - browser_, + owner_->browser(), this, arrow_location, inspect_with_devtools); popup_->GetWidget()->AddObserver(this); } else { - Profile* profile = owner_->profile(); + Profile* profile = owner_->browser()->profile(); ExtensionService* service = profile->GetExtensionService(); service->browser_event_router()->PageActionExecuted( profile, page_action_->extension_id(), page_action_->id(), @@ -160,13 +159,14 @@ bool PageActionImageView::OnKeyPressed(const views::KeyEvent& event) { void PageActionImageView::ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture) { - const Extension* extension = owner_->profile()->GetExtensionService()-> - GetExtensionById(page_action()->extension_id(), false); + const Extension* extension = owner_->browser()->profile()-> + GetExtensionService()->GetExtensionById(page_action()->extension_id(), + false); if (!extension->ShowConfigureContextMenus()) return; scoped_refptr context_menu_model( - new ExtensionContextMenuModel(extension, browser_, this)); + new ExtensionContextMenuModel(extension, owner_->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 ef96d12..1390189 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,7 +15,6 @@ #include "chrome/browser/ui/views/extensions/extension_popup.h" #include "ui/views/controls/image_view.h" -class Browser; class LocationBarView; namespace content { @@ -34,8 +33,7 @@ class PageActionImageView : public views::ImageView, public content::NotificationObserver { public: PageActionImageView(LocationBarView* owner, - ExtensionAction* page_action, - Browser* browser); + ExtensionAction* page_action); virtual ~PageActionImageView(); ExtensionAction* page_action() { return page_action_; } @@ -93,9 +91,6 @@ 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 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 edbb9c8..3438ee3 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->profile())), + parent_view->browser()->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 efb6b2b..34b7857 100644 --- a/chrome/browser/ui/views/reload_button.cc +++ b/chrome/browser/ui/views/reload_button.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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/command_updater.h" +#include "chrome/browser/ui/browser.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,11 +19,10 @@ const char ReloadButton::kViewClassName[] = "browser/ui/views/ReloadButton"; //////////////////////////////////////////////////////////////////////////////// // ReloadButton, public: -ReloadButton::ReloadButton(LocationBarView* location_bar, - CommandUpdater* command_updater) +ReloadButton::ReloadButton(LocationBarView* location_bar, Browser* browser) : ALLOW_THIS_IN_INITIALIZER_LIST(ToggleImageButton(this)), location_bar_(location_bar), - command_updater_(command_updater), + browser_(browser), intended_mode_(MODE_RELOAD), visible_mode_(MODE_RELOAD), double_click_timer_delay_( @@ -73,14 +72,16 @@ void ReloadButton::ChangeMode(Mode mode, bool force) { void ReloadButton::ButtonPressed(views::Button* /* button */, const views::Event& event) { if (visible_mode_ == MODE_STOP) { - if (command_updater_) - command_updater_->ExecuteCommandWithDisposition(IDC_STOP, CURRENT_TAB); + if (browser_) + browser_->Stop(); // 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()) { @@ -108,8 +109,8 @@ void ReloadButton::ButtonPressed(views::Button* /* button */, double_click_timer_.Start(FROM_HERE, double_click_timer_delay_, this, &ReloadButton::OnDoubleClickTimer); - if (command_updater_) - command_updater_->ExecuteCommandWithDisposition(command, disposition); + if (browser_) + browser_->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 3aee697..7de8245 100644 --- a/chrome/browser/ui/views/reload_button.h +++ b/chrome/browser/ui/views/reload_button.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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 CommandUpdater; +class Browser; class LocationBarView; //////////////////////////////////////////////////////////////////////////////// @@ -33,7 +33,7 @@ class ReloadButton : public views::ToggleImageButton, // The button's class name. static const char kViewClassName[]; - ReloadButton(LocationBarView* location_bar, CommandUpdater* command_updater); + ReloadButton(LocationBarView* location_bar, Browser* Browser); 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_; - CommandUpdater* command_updater_; + Browser* browser_; // 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 61c629ca..575bc1a 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -10,7 +10,6 @@ #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" @@ -18,7 +17,6 @@ #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" @@ -171,15 +169,11 @@ 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_->profile(), - browser_->command_updater(), - model_, - this, + location_bar_ = new LocationBarView(browser_, model_, this, (display_mode_ == DISPLAYMODE_LOCATION) ? LocationBarView::POPUP : LocationBarView::NORMAL); - reload_ = new ReloadButton(location_bar_, browser_->command_updater()); + reload_ = new ReloadButton(location_bar_, browser_); reload_->set_triggerable_event_flags(ui::EF_LEFT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON); reload_->set_tag(IDC_RELOAD); @@ -372,28 +366,6 @@ 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 4d044bd..fbaa688 100644 --- a/chrome/browser/ui/views/toolbar_view.h +++ b/chrome/browser/ui/views/toolbar_view.h @@ -93,16 +93,6 @@ 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 aefd66b..855d2b1e 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2325,10 +2325,6 @@ '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', @@ -2782,7 +2778,6 @@ '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', @@ -3193,7 +3188,6 @@ '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', -- cgit v1.1