diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-09 23:22:20 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-09 23:22:20 +0000 |
commit | 6354314433a94aa6656499d79ff17f220220ab0f (patch) | |
tree | 74dc4cd4bd7b88a9833e7125b545ba2287ee9e92 /chrome | |
parent | 6a760c99f8a9590f8643a832d50980c60c5c3931 (diff) | |
download | chromium_src-6354314433a94aa6656499d79ff17f220220ab0f.zip chromium_src-6354314433a94aa6656499d79ff17f220220ab0f.tar.gz chromium_src-6354314433a94aa6656499d79ff17f220220ab0f.tar.bz2 |
Make the content settings dialog dependent on its parent. This re-plumbs the "show" function to work more like a number of our other dialogs (i.e. delcared in browser_dialogs.h), and adds a TabContentsDelegate function so the content blocked info bubbles can ask the appropriate window to show the dialog.
BUG=35084
TEST=Open the content settings dialog from either the options or a content blocked info bubble. Click its parent window. The dialog should stay on top of the parent.
Review URL: http://codereview.chromium.org/597009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38534 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
20 files changed, 113 insertions, 73 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index a8e222b..ef8f20aa 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -2313,6 +2313,10 @@ void Browser::ShowRepostFormWarningDialog(TabContents *tab_contents) { window()->ShowRepostFormWarningDialog(tab_contents); } +void Browser::ShowContentSettingsWindow(ContentSettingsType content_type) { + window()->ShowContentSettingsWindow(content_type, profile_); +} + bool Browser::ShouldAddNavigationsToHistory() const { // Don't update history if running as app. return !IsApplication(); diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index 945a677..e7123c8 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -624,6 +624,7 @@ class Browser : public TabStripModelDelegate, bool* is_keyboard_shortcut); virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); virtual void ShowRepostFormWarningDialog(TabContents* tab_contents); + virtual void ShowContentSettingsWindow(ContentSettingsType content_type); virtual bool ShouldAddNavigationsToHistory() const; virtual void OnDidGetApplicationInfo(TabContents* tab_contents, int32 page_id); diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h index a5dae90..ab38295 100644 --- a/chrome/browser/browser_window.h +++ b/chrome/browser/browser_window.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 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. @@ -7,6 +7,7 @@ #include "app/gfx/native_widget_types.h" #include "chrome/browser/tab_contents/navigation_entry.h" +#include "chrome/common/content_settings_types.h" class Browser; class BrowserWindowTesting; @@ -211,6 +212,10 @@ class BrowserWindow { // Shows the repost form confirmation dialog box. virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) = 0; + // Shows the Content Settings dialog box. + virtual void ShowContentSettingsWindow(ContentSettingsType content_type, + Profile* profile) = 0; + // Shows a dialog to the user that something is wrong with the profile. // |message_id| is the ID for a string in the string table which will be // displayed in the dialog. diff --git a/chrome/browser/cocoa/browser_window_cocoa.h b/chrome/browser/cocoa/browser_window_cocoa.h index 0e405b7..3f0542a 100644 --- a/chrome/browser/cocoa/browser_window_cocoa.h +++ b/chrome/browser/cocoa/browser_window_cocoa.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 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. @@ -77,6 +77,8 @@ class BrowserWindowCocoa : public BrowserWindow, virtual void ShowSelectProfileDialog(); virtual void ShowNewProfileDialog(); virtual void ShowRepostFormWarningDialog(TabContents* tab_contents); + virtual void ShowContentSettingsWindow(ContentSettingsType content_type, + Profile* profile); virtual void ShowProfileErrorDialog(int message_id); virtual void ShowThemeInstallBubble(); virtual void ConfirmBrowserCloseWithPendingDownloads(); diff --git a/chrome/browser/cocoa/browser_window_cocoa.mm b/chrome/browser/cocoa/browser_window_cocoa.mm index e573f2d..24186b3 100644 --- a/chrome/browser/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/cocoa/browser_window_cocoa.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 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. @@ -317,6 +317,12 @@ void BrowserWindowCocoa::ShowRepostFormWarningDialog( new RepostFormWarningMac(GetNativeHandle(), &tab_contents->controller()); } +void BrowserWindowCocoa::ShowContentSettingsWindow( + ContentSettingsType content_type, + Profile* profile) { + NOTIMPLEMENTED(); +} + void BrowserWindowCocoa::ShowProfileErrorDialog(int message_id) { scoped_nsobject<NSAlert> alert([[NSAlert alloc] init]); [alert addButtonWithTitle:l10n_util::GetNSStringWithFixup(IDS_OK)]; diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index c3bf87b..267f93d 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 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. @@ -871,6 +871,12 @@ void BrowserWindowGtk::ShowRepostFormWarningDialog( new RepostFormWarningGtk(GetNativeHandle(), &tab_contents->controller()); } +void BrowserWindowGtk::ShowContentSettingsWindow( + ContentSettingsType content_type, + Profile* profile) { + NOTIMPLEMENTED(); +} + void BrowserWindowGtk::ShowProfileErrorDialog(int message_id) { std::string title = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); std::string message = l10n_util::GetStringUTF8(message_id); diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h index 711c535..0cf15a6 100644 --- a/chrome/browser/gtk/browser_window_gtk.h +++ b/chrome/browser/gtk/browser_window_gtk.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 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. @@ -96,6 +96,8 @@ class BrowserWindowGtk : public BrowserWindow, virtual void ShowSelectProfileDialog(); virtual void ShowNewProfileDialog(); virtual void ShowRepostFormWarningDialog(TabContents* tab_contents); + virtual void ShowContentSettingsWindow(ContentSettingsType content_type, + Profile* profile); virtual void ShowProfileErrorDialog(int message_id); virtual void ShowThemeInstallBubble(); virtual void ConfirmBrowserCloseWithPendingDownloads(); diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h index a193b2e..9db2245 100644 --- a/chrome/browser/tab_contents/tab_contents_delegate.h +++ b/chrome/browser/tab_contents/tab_contents_delegate.h @@ -11,6 +11,7 @@ #include "base/basictypes.h" #include "base/gfx/rect.h" #include "chrome/browser/tab_contents/navigation_entry.h" +#include "chrome/common/content_settings_types.h" #include "chrome/common/native_web_keyboard_event.h" #include "chrome/common/page_transition_types.h" #include "webkit/glue/context_menu.h" @@ -254,6 +255,9 @@ class TabContentsDelegate { // Shows the repost form confirmation dialog box. virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) {} + // Shows the Content Settings dialog for a given content type. + virtual void ShowContentSettingsWindow(ContentSettingsType content_type) {} + // Allows delegate to override navigation to the history entries. // Returns true to allow TabContents to continue with the default processing. virtual bool OnGoToEntryOffset(int offset) { diff --git a/chrome/browser/views/browser_dialogs.h b/chrome/browser/views/browser_dialogs.h index f73bdf6..1a86762 100644 --- a/chrome/browser/views/browser_dialogs.h +++ b/chrome/browser/views/browser_dialogs.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 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,6 +8,7 @@ #include <string> #include "app/gfx/native_widget_types.h" +#include "chrome/common/content_settings_types.h" // This file contains functions for running a variety of browser dialogs and // popups. The dialogs here are the ones that the caller does not need to @@ -109,6 +110,11 @@ void EditSearchEngine(gfx::NativeWindow parent, void ShowRepostFormWarningDialog(gfx::NativeWindow parent_window, TabContents* tab_contents); +// Shows the content settings dialog box. +void ShowContentSettingsWindow(gfx::NativeWindow parent_window, + ContentSettingsType content_type, + Profile* profile); + // Shows the create web app shortcut dialog box. void ShowCreateShortcutsDialog(gfx::NativeWindow parent_window, TabContents* tab_contents); diff --git a/chrome/browser/views/content_blocked_bubble_contents.cc b/chrome/browser/views/content_blocked_bubble_contents.cc index f3d5635..4646400 100644 --- a/chrome/browser/views/content_blocked_bubble_contents.cc +++ b/chrome/browser/views/content_blocked_bubble_contents.cc @@ -9,6 +9,7 @@ #include "chrome/browser/host_content_settings_map.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/browser/views/browser_dialogs.h" #include "chrome/browser/views/info_bubble.h" #include "chrome/common/notification_source.h" #include "chrome/common/notification_type.h" @@ -20,10 +21,6 @@ #include "views/grid_layout.h" #include "views/standard_layout.h" -#if defined(OS_WIN) -#include "chrome/browser/views/options/content_settings_window_view.h" -#endif - ContentBlockedBubbleContents::ContentBlockedBubbleContents( ContentSettingsType content_type, const std::string& host, @@ -69,14 +66,13 @@ void ContentBlockedBubbleContents::ButtonPressed(views::Button* sender, void ContentBlockedBubbleContents::LinkActivated(views::Link* source, int event_flags) { if (source == manage_link_) { -#if defined(OS_WIN) - ContentSettingsWindowView::Show(content_type_, profile_); + if (tab_contents_) + tab_contents_->delegate()->ShowContentSettingsWindow(content_type_); + else + browser::ShowContentSettingsWindow(NULL, content_type_, profile_); // CAREFUL: Showing the settings window activates it, which deactivates the // info bubble, which causes it to close, which deletes us. return; -#else - // TODO(pkasting): Linux views doesn't have the same options dialogs. -#endif } PopupLinks::const_iterator i(popup_links_.find(source)); diff --git a/chrome/browser/views/cookie_prompt_view.cc b/chrome/browser/views/cookie_prompt_view.cc index 9a69ad9..80619b2 100644 --- a/chrome/browser/views/cookie_prompt_view.cc +++ b/chrome/browser/views/cookie_prompt_view.cc @@ -14,6 +14,7 @@ #include "base/string_util.h" #include "chrome/browser/cookie_modal_dialog.h" #include "chrome/browser/profile.h" +#include "chrome/browser/views/browser_dialogs.h" #include "chrome/browser/views/cookie_info_view.h" #include "chrome/browser/views/local_storage_info_view.h" #include "chrome/browser/views/options/content_settings_window_view.h" @@ -137,12 +138,14 @@ void CookiePromptView::ButtonPressed(views::Button* sender, /////////////////////////////////////////////////////////////////////////////// // CookiePromptView, views::LinkController implementation: void CookiePromptView::LinkActivated(views::Link* source, int event_flags) { - if (source == show_cookie_link_) + if (source == show_cookie_link_) { ToggleDetailsViewExpand(); - else if (source == manage_cookies_link_) - ContentSettingsWindowView::Show(CONTENT_SETTINGS_TYPE_COOKIES, profile_); - else - NOTREACHED(); + return; + } + + DCHECK_EQ(source, manage_cookies_link_); + browser::ShowContentSettingsWindow(root_window_, + CONTENT_SETTINGS_TYPE_COOKIES, profile_); } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/views/dialog_stubs_gtk.cc b/chrome/browser/views/dialog_stubs_gtk.cc index 9d8c7d2..863113b 100644 --- a/chrome/browser/views/dialog_stubs_gtk.cc +++ b/chrome/browser/views/dialog_stubs_gtk.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 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. @@ -75,4 +75,10 @@ void ShowRepostFormWarningDialog(gfx::NativeWindow parent_window, &tab_contents->controller()); } +void ShowContentSettingsWindow(gfx::NativeWindow parent_window, + ContentSettingsType content_type, + Profile* profile) { + NOTIMPLEMENTED(); +} + } // namespace browser diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index a339aaa..6d69366 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 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. @@ -1034,6 +1034,11 @@ void BrowserView::ShowRepostFormWarningDialog(TabContents* tab_contents) { browser::ShowRepostFormWarningDialog(GetNativeHandle(), tab_contents); } +void BrowserView::ShowContentSettingsWindow(ContentSettingsType content_type, + Profile* profile) { + browser::ShowContentSettingsWindow(GetNativeHandle(), content_type, profile); +} + void BrowserView::ShowProfileErrorDialog(int message_id) { #if defined(OS_WIN) std::wstring title = l10n_util::GetString(IDS_PRODUCT_NAME); diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index 5bcfcd1..0496023 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 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. @@ -281,6 +281,8 @@ class BrowserView : public BrowserWindow, virtual void ShowSelectProfileDialog(); virtual void ShowNewProfileDialog(); virtual void ShowRepostFormWarningDialog(TabContents* tab_contents); + virtual void ShowContentSettingsWindow(ContentSettingsType content_type, + Profile* profile); virtual void ShowProfileErrorDialog(int message_id); virtual void ShowThemeInstallBubble(); virtual void ConfirmBrowserCloseWithPendingDownloads(); diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc index 94750b9..efe399f 100644 --- a/chrome/browser/views/options/advanced_contents_view.cc +++ b/chrome/browser/views/options/advanced_contents_view.cc @@ -32,6 +32,7 @@ #include "chrome/browser/renderer_host/resource_dispatcher_host.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/browser/shell_dialogs.h" +#include "chrome/browser/views/browser_dialogs.h" #include "chrome/browser/views/clear_browsing_data.h" #include "chrome/browser/views/options/content_settings_window_view.h" #include "chrome/browser/views/options/fonts_languages_window_view.h" @@ -547,7 +548,8 @@ void PrivacySection::ButtonPressed( enable_metrics_recording_.SetValue(enabled); } else if (sender == content_settings_button_) { UserMetricsRecordAction("Options_ContentSettings", NULL); - ContentSettingsWindowView::Show(CONTENT_SETTINGS_TYPE_DEFAULT, profile()); + browser::ShowContentSettingsWindow(GetWindow()->GetNativeWindow(), + CONTENT_SETTINGS_TYPE_DEFAULT, profile()); } else if (sender == clear_data_button_) { UserMetricsRecordAction("Options_ClearData", NULL); views::Window::CreateChromeWindow( diff --git a/chrome/browser/views/options/content_settings_window_view.cc b/chrome/browser/views/options/content_settings_window_view.cc index 1610751..060e4c9 100644 --- a/chrome/browser/views/options/content_settings_window_view.cc +++ b/chrome/browser/views/options/content_settings_window_view.cc @@ -27,12 +27,12 @@ static ContentSettingsWindowView* instance_ = NULL; // Content setting dialog bounds padding. static const int kDialogPadding = 7; -/////////////////////////////////////////////////////////////////////////////// -// ContentSettingsWindowView, public: +namespace browser { -// static -void ContentSettingsWindowView::Show(ContentSettingsType page, - Profile* profile) { +// Declared in browser_dialogs.h so others don't have to depend on our header. +void ShowContentSettingsWindow(gfx::NativeWindow parent_window, + ContentSettingsType content_type, + Profile* profile) { DCHECK(profile); // If there's already an existing options window, activate it and switch to // the specified page. @@ -40,12 +40,16 @@ void ContentSettingsWindowView::Show(ContentSettingsType page, // about this case this will have to be fixed. if (!instance_) { instance_ = new ContentSettingsWindowView(profile); - views::Window::CreateChromeWindow(NULL, gfx::Rect(), instance_); - // The window is alive by itself now... + views::Window::CreateChromeWindow(parent_window, gfx::Rect(), instance_); } - instance_->ShowContentSettingsTab(page); + instance_->ShowContentSettingsTab(content_type); } +}; + +/////////////////////////////////////////////////////////////////////////////// +// ContentSettingsWindowView, public: + // static void ContentSettingsWindowView::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterIntegerPref(prefs::kContentSettingsWindowLastTabIndex, 0); @@ -65,6 +69,24 @@ ContentSettingsWindowView::ContentSettingsWindowView(Profile* profile) ContentSettingsWindowView::~ContentSettingsWindowView() { } +void ContentSettingsWindowView::ShowContentSettingsTab( + ContentSettingsType page) { + // This will show invisible windows and bring visible windows to the front. + window()->Show(); + + if (page == CONTENT_SETTINGS_TYPE_DEFAULT) { + // Remember the last visited page from local state. + page = static_cast<ContentSettingsType>(last_selected_page_.GetValue()); + if (page == CONTENT_SETTINGS_TYPE_DEFAULT) + page = CONTENT_SETTINGS_TYPE_COOKIES; + } + // If the page number is out of bounds, reset to the first tab. + if (page < 0 || page >= tabs_->GetTabCount()) + page = CONTENT_SETTINGS_TYPE_COOKIES; + + tabs_->SelectTabAt(static_cast<int>(page)); +} + /////////////////////////////////////////////////////////////////////////////// // ContentSettingsWindowView, views::DialogDelegate implementation: @@ -158,28 +180,6 @@ void ContentSettingsWindowView::Init() { DCHECK_EQ(tabs_->GetTabCount(), CONTENT_SETTINGS_NUM_TYPES); } -void ContentSettingsWindowView::ShowContentSettingsTab( - ContentSettingsType page) { - // If the window is not yet visible, we need to show it (it will become - // active), otherwise just bring it to the front. - if (!window()->IsVisible()) - window()->Show(); - else - window()->Activate(); - - if (page == CONTENT_SETTINGS_TYPE_DEFAULT) { - // Remember the last visited page from local state. - page = static_cast<ContentSettingsType>(last_selected_page_.GetValue()); - if (page == CONTENT_SETTINGS_TYPE_DEFAULT) - page = CONTENT_SETTINGS_TYPE_COOKIES; - } - // If the page number is out of bounds, reset to the first tab. - if (page < 0 || page >= tabs_->GetTabCount()) - page = CONTENT_SETTINGS_TYPE_COOKIES; - - tabs_->SelectTabAt(static_cast<int>(page)); -} - const OptionsPageView* ContentSettingsWindowView::GetCurrentContentSettingsTabView() const { return static_cast<OptionsPageView*>(tabs_->GetSelectedTab()); diff --git a/chrome/browser/views/options/content_settings_window_view.h b/chrome/browser/views/options/content_settings_window_view.h index eed2431..634416d 100644 --- a/chrome/browser/views/options/content_settings_window_view.h +++ b/chrome/browser/views/options/content_settings_window_view.h @@ -24,16 +24,14 @@ class ContentSettingsWindowView : public views::View, public views::DialogDelegate, public views::TabbedPane::Listener { public: - // Show the Content Settings window selecting the specified page. - // If a Content Settings window is currently open, this just activates it - // instead of opening a new one. - static void Show(ContentSettingsType page, Profile* profile); - static void RegisterUserPrefs(PrefService* prefs); explicit ContentSettingsWindowView(Profile* profile); virtual ~ContentSettingsWindowView(); + // Shows the Tab corresponding to the specified Content Settings page. + void ShowContentSettingsTab(ContentSettingsType page); + protected: // views::View overrides: virtual void Layout(); @@ -58,9 +56,6 @@ class ContentSettingsWindowView : public views::View, // Initializes the view. void Init(); - // Shows the Tab corresponding to the specified Content Settings page. - void ShowContentSettingsTab(ContentSettingsType page); - // Returns the currently selected OptionsPageView. const OptionsPageView* GetCurrentContentSettingsTabView() const; diff --git a/chrome/browser/views/options/fonts_languages_window_view.cc b/chrome/browser/views/options/fonts_languages_window_view.cc index 7d7f38f..d26aea2 100644 --- a/chrome/browser/views/options/fonts_languages_window_view.cc +++ b/chrome/browser/views/options/fonts_languages_window_view.cc @@ -131,7 +131,6 @@ void ShowFontsLanguagesWindow(gfx::NativeWindow window, if (!instance_) { instance_ = new FontsLanguagesWindowView(profile); views::Window::CreateChromeWindow(window, gfx::Rect(), instance_); - // The window is alive by itself now... } instance_->ShowTabPage(page); } diff --git a/chrome/browser/views/options/options_window_view.cc b/chrome/browser/views/options/options_window_view.cc index 57c2e3a..1461683 100644 --- a/chrome/browser/views/options/options_window_view.cc +++ b/chrome/browser/views/options/options_window_view.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 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. @@ -118,13 +118,8 @@ void OptionsWindowView::ShowOptionsPage(OptionsPage page, window()->SetBounds(gfx::Rect(origin, window()->GetBounds().size()), NULL); } - // If the window is not yet visible, we need to show it (it will become - // active), otherwise just bring it to the front. - if (!window()->IsVisible()) { - window()->Show(); - } else { - window()->Activate(); - } + // This will show invisible windows and bring visible windows to the front. + window()->Show(); if (page == OPTIONS_PAGE_DEFAULT) { // Remember the last visited page from local state. @@ -240,7 +235,6 @@ void ShowOptionsWindow(OptionsPage page, if (!instance_) { instance_ = new OptionsWindowView(profile); views::Window::CreateChromeWindow(NULL, gfx::Rect(), instance_); - // The window is alive by itself now... } instance_->ShowOptionsPage(page, highlight_group); } diff --git a/chrome/test/test_browser_window.h b/chrome/test/test_browser_window.h index d994961..58ef32d 100644 --- a/chrome/test/test_browser_window.h +++ b/chrome/test/test_browser_window.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 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. @@ -81,6 +81,8 @@ class TestBrowserWindow : public BrowserWindow { virtual void ShowSelectProfileDialog() {} virtual void ShowNewProfileDialog() {} virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) {} + virtual void ShowContentSettingsWindow(ContentSettingsType content_type, + Profile* profile) {} virtual void ShowProfileErrorDialog(int message_id) {} virtual void ShowThemeInstallBubble() {} virtual void ConfirmBrowserCloseWithPendingDownloads() {} |