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

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: fix stuff 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 // static
13 OptionsManagedBannerHandler* OptionsManagedBannerHandler::Create(
14 WebUI* web_ui, const string16& page_name, OptionsPage page) {
15 return new OptionsManagedBannerHandler(web_ui, page_name, page);
16 }
17
18 OptionsManagedBannerHandler::OptionsManagedBannerHandler(
19 WebUI* web_ui, const string16& page_name, OptionsPage page)
20 : policy::ManagedPrefsBannerBase(web_ui->GetProfile()->GetPrefs(), page),
21 web_ui_(web_ui), page_name_(page_name), page_(page) {
22 // Initialize the visibility state of the banner.
23 SetupBannerVisibility();
24 }
25
26 OptionsManagedBannerHandler::~OptionsManagedBannerHandler() {}
27
28 void OptionsManagedBannerHandler::OnUpdateVisibility() {
29 // A preference that may be managed has changed. Update our visibility
30 // state.
31 SetupBannerVisibility();
32 }
33
34 void OptionsManagedBannerHandler::SetupBannerVisibility() {
35 // Construct the banner visibility script name.
36 std::string script = "options." + UTF16ToASCII(page_name_) +
37 ".getInstance().setManagedBannerVisibility";
38
39 // Get the visiblity value from the base class.
40 FundamentalValue visibility(DetermineVisibility());
41
42 // Set the managed state in the javascript handler.
43 web_ui_->CallJavascriptFunction(script, visibility);
44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698