summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authormnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-15 09:13:58 +0000
committermnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-15 09:13:58 +0000
commit7bef619f7f1cde7d07e5642afd5a780c15e3e6d9 (patch)
tree8b68565aacb1fea1ea1ceea7e1525dab503d8f1a /chrome/browser/views
parentec5c5f2cc84954fc2e745887bea3f006c5f8e7d7 (diff)
downloadchromium_src-7bef619f7f1cde7d07e5642afd5a780c15e3e6d9.zip
chromium_src-7bef619f7f1cde7d07e5642afd5a780c15e3e6d9.tar.gz
chromium_src-7bef619f7f1cde7d07e5642afd5a780c15e3e6d9.tar.bz2
Show the managed prefs warning banner for some advanced options.
BUG=48470 TEST=Configure policy, check advanced page of preferences dialog. Review URL: http://codereview.chromium.org/2908007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52467 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/options/advanced_page_view.cc6
-rw-r--r--chrome/browser/views/options/content_page_view.cc11
-rw-r--r--chrome/browser/views/options/general_page_view.cc11
-rw-r--r--chrome/browser/views/options/managed_prefs_banner_view.cc5
-rw-r--r--chrome/browser/views/options/managed_prefs_banner_view.h9
5 files changed, 14 insertions, 28 deletions
diff --git a/chrome/browser/views/options/advanced_page_view.cc b/chrome/browser/views/options/advanced_page_view.cc
index f506400..9c75994 100644
--- a/chrome/browser/views/options/advanced_page_view.cc
+++ b/chrome/browser/views/options/advanced_page_view.cc
@@ -9,7 +9,9 @@
#include "base/string_util.h"
#include "base/values.h"
#include "chrome/browser/options_util.h"
+#include "chrome/browser/profile.h"
#include "chrome/browser/views/options/advanced_contents_view.h"
+#include "chrome/browser/views/options/managed_prefs_banner_view.h"
#include "chrome/common/chrome_constants.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -130,6 +132,10 @@ void AdvancedPageView::InitControlLayout() {
ColumnSet* column_set = layout->AddColumnSet(single_column_view_set_id);
column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
GridLayout::USE_PREF, 0, 0);
+ layout->StartRow(0, single_column_view_set_id);
+ layout->AddView(
+ new ManagedPrefsBannerView(profile()->GetPrefs(), OPTIONS_PAGE_ADVANCED));
+
layout->StartRow(1, single_column_view_set_id);
layout->AddView(advanced_scroll_view_);
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc
index 093c90d..1a368e7 100644
--- a/chrome/browser/views/options/content_page_view.cc
+++ b/chrome/browser/views/options/content_page_view.cc
@@ -50,12 +50,6 @@ const int kFormAutofillRadioGroup = 202;
// Background color for the status label when it's showing an error.
static const SkColor kSyncLabelErrorBgColor = SkColorSetRGB(0xff, 0x9a, 0x9a);
-// All content related preferences that are potentially managed by policy. We'll
-// display the warning banner if one of these have the managed bit set.
-const wchar_t* kContentPolicyConstrainedPrefs[] = {
- prefs::kSyncManaged
-};
-
static views::Background* CreateErrorBackground() {
return views::Background::CreateSolidBackground(kSyncLabelErrorBgColor);
}
@@ -206,9 +200,8 @@ void ContentPageView::InitControlLayout() {
layout->StartRow(0, single_column_view_set_id);
layout->AddView(
- new ManagedPrefsBannerView(profile()->GetPrefs(),
- kContentPolicyConstrainedPrefs,
- arraysize(kContentPolicyConstrainedPrefs)));
+ new ManagedPrefsBannerView(profile()->GetPrefs(), OPTIONS_PAGE_CONTENT));
+
if (sync_service_) {
layout->StartRow(0, single_column_view_set_id);
InitSyncGroup();
diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc
index d7c36a7..be464b4 100644
--- a/chrome/browser/views/options/general_page_view.cc
+++ b/chrome/browser/views/options/general_page_view.cc
@@ -44,13 +44,6 @@ const SkColor kDefaultBrowserLabelColor = SkColorSetRGB(0, 135, 0);
const SkColor kNotDefaultBrowserLabelColor = SkColorSetRGB(135, 0, 0);
const int kHomePageTextfieldWidthChars = 40;
-// All general preferences that are potentially managed by policy. We'll
-// display the warning banner if one of these have the managed bit set.
-const wchar_t* kGeneralPolicyConstrainedPrefs[] = {
- prefs::kHomePage,
- prefs::kHomePageIsNewTabPage
-};
-
} // namespace
///////////////////////////////////////////////////////////////////////////////
@@ -318,9 +311,7 @@ void GeneralPageView::InitControlLayout() {
layout->StartRow(0, single_column_view_set_id);
layout->AddView(
- new ManagedPrefsBannerView(profile()->GetPrefs(),
- kGeneralPolicyConstrainedPrefs,
- arraysize(kGeneralPolicyConstrainedPrefs)));
+ new ManagedPrefsBannerView(profile()->GetPrefs(), OPTIONS_PAGE_GENERAL));
layout->StartRow(0, single_column_view_set_id);
InitStartupGroup();
diff --git a/chrome/browser/views/options/managed_prefs_banner_view.cc b/chrome/browser/views/options/managed_prefs_banner_view.cc
index 020617c..09febc4 100644
--- a/chrome/browser/views/options/managed_prefs_banner_view.cc
+++ b/chrome/browser/views/options/managed_prefs_banner_view.cc
@@ -19,9 +19,8 @@ static const int kPrefsBannerPadding = 3;
static const int kPrefsBannerBorderSize = 1;
ManagedPrefsBannerView::ManagedPrefsBannerView(PrefService* prefs,
- const wchar_t** relevant_prefs,
- size_t count)
- : ManagedPrefsBannerBase(prefs, relevant_prefs, count) {
+ OptionsPage page)
+ : ManagedPrefsBannerBase(prefs, page) {
content_ = new views::View;
SkColor border_color = color_utils::GetSysSkColor(COLOR_3DSHADOW);
views::Border* border = views::Border::CreateSolidBorder(
diff --git a/chrome/browser/views/options/managed_prefs_banner_view.h b/chrome/browser/views/options/managed_prefs_banner_view.h
index 60c9953..6002ada 100644
--- a/chrome/browser/views/options/managed_prefs_banner_view.h
+++ b/chrome/browser/views/options/managed_prefs_banner_view.h
@@ -19,12 +19,9 @@ class Label;
class ManagedPrefsBannerView : public ManagedPrefsBannerBase,
public views::View {
public:
- // Initialize the banner. |relevant_prefs| is an array of |count| prefs
- // holding names of the preferences that control the banner visibility
- // through their managed flag.
- ManagedPrefsBannerView(PrefService* pref_service,
- const wchar_t** relevant_prefs,
- size_t count);
+ // Initialize the banner. |page| is used to determine the names of the
+ // preferences that control the banner visibility through their managed flag.
+ ManagedPrefsBannerView(PrefService* pref_service, OptionsPage page);
virtual ~ManagedPrefsBannerView() {}
private: