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

Side by Side Diff: chrome/browser/ui/webui/options/options_managed_banner_handler.cc

Issue 7342009: Show a different banner in chrome://settings for extension-controlled settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/options/options_managed_banner_handler.h"
6
7 #include "base/string_util.h"
8 #include "base/values.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "content/browser/webui/web_ui.h"
11
12 OptionsManagedBannerHandler::OptionsManagedBannerHandler(
13 WebUI* web_ui, const string16& page_name, OptionsPage page)
14 : policy::ManagedPrefsBannerBase(web_ui->GetProfile()->GetPrefs(), page),
15 web_ui_(web_ui), page_name_(page_name), page_(page) {
16 // Initialize the visibility state of the banner.
17 SetupBannerVisibility();
18 }
19
20 OptionsManagedBannerHandler::~OptionsManagedBannerHandler() {}
21
22 void OptionsManagedBannerHandler::OnUpdateVisibility() {
23 // A preference that may be managed has changed. Update our visibility
24 // state.
25 SetupBannerVisibility();
26 }
27
28 void OptionsManagedBannerHandler::SetupBannerVisibility() {
29 // Construct the banner visibility script name.
30 std::string script = "options." + UTF16ToASCII(page_name_) +
31 ".getInstance().setManagedBannerVisibility";
32
33 // Get the visiblity value from the base class.
34 FundamentalValue visibility(DetermineVisibility());
35
36 // Set the managed state in the javascript handler.
37 web_ui_->CallJavascriptFunction(script, visibility);
38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698