summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/browser_dialogs.h8
-rw-r--r--chrome/browser/views/content_blocked_bubble_contents.cc14
-rw-r--r--chrome/browser/views/cookie_prompt_view.cc13
-rw-r--r--chrome/browser/views/dialog_stubs_gtk.cc8
-rw-r--r--chrome/browser/views/frame/browser_view.cc7
-rw-r--r--chrome/browser/views/frame/browser_view.h4
-rw-r--r--chrome/browser/views/options/advanced_contents_view.cc4
-rw-r--r--chrome/browser/views/options/content_settings_window_view.cc60
-rw-r--r--chrome/browser/views/options/content_settings_window_view.h11
-rw-r--r--chrome/browser/views/options/fonts_languages_window_view.cc1
-rw-r--r--chrome/browser/views/options/options_window_view.cc12
11 files changed, 75 insertions, 67 deletions
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);
}