Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(736)

Unified Diff: chrome/browser/dom_ui/options_managed_banner_handler.cc

Issue 3108018: Display a banner above each panel that contains managed options.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/dom_ui/options_managed_banner_handler.cc
===================================================================
--- chrome/browser/dom_ui/options_managed_banner_handler.cc (revision 0)
+++ chrome/browser/dom_ui/options_managed_banner_handler.cc (revision 0)
@@ -0,0 +1,37 @@
+// 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.
+
+#include "chrome/browser/dom_ui/options_managed_banner_handler.h"
+
+#include "base/utf_string_conversions.h"
+#include "base/values.h"
+#include "chrome/browser/dom_ui/dom_ui.h"
+#include "chrome/browser/profile.h"
+
+OptionsManagedBannerHandler::OptionsManagedBannerHandler(
+ DOMUI* dom_ui, const string16& page_name, OptionsPage page)
+ : ManagedPrefsBannerBase(dom_ui->GetProfile()->GetPrefs(), page),
+ dom_ui_(dom_ui), page_name_(page_name), page_(page) {
+ // Initialize the visibility state of the banner.
+ SetupBannerVisibilty();
+}
+
+void OptionsManagedBannerHandler::OnUpdateVisibility() {
+ // A preference that may be managed has changed. Update our visibility
+ // state.
+ SetupBannerVisibilty();
+}
+
+void OptionsManagedBannerHandler::SetupBannerVisibilty() {
+ // Construct the banner visibility script name.
+ string16 script = ASCIIToUTF16("options.") + page_name_ +
+ ASCIIToUTF16(".getInstance().setManagedBannerVisibility");
+
+ // Get the visiblity value from the base class.
+ FundamentalValue visibility(DetermineVisibility());
+
+ // Set the managed state in the javascript handler.
+ dom_ui_->CallJavascriptFunction(UTF16ToWideHack(script), visibility);
+}
+
Property changes on: chrome/browser/dom_ui/options_managed_banner_handler.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/dom_ui/options_managed_banner_handler.h ('k') | chrome/browser/dom_ui/personal_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698