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

Side by Side Diff: chrome/browser/gtk/options/managed_prefs_banner_gtk.cc

Issue 6251001: Move chrome/browser/gtk/ to chrome/browser/ui/gtk/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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) 2010 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/gtk/options/managed_prefs_banner_gtk.h"
6
7 #include "app/l10n_util.h"
8 #include "chrome/browser/gtk/gtk_theme_provider.h"
9 #include "chrome/browser/gtk/gtk_util.h"
10 #include "grit/generated_resources.h"
11
12 namespace {
13
14 // Padding within the banner box.
15 const int kBannerPadding = 3;
16
17 }
18
19 ManagedPrefsBannerGtk::ManagedPrefsBannerGtk(PrefService* prefs,
20 OptionsPage page)
21 : policy::ManagedPrefsBannerBase(prefs, page),
22 banner_widget_(NULL) {
23 InitWidget();
24 OnUpdateVisibility();
25 }
26
27 void ManagedPrefsBannerGtk::InitWidget() {
28 banner_widget_ = gtk_frame_new(NULL);
29 GtkWidget* contents = gtk_hbox_new(FALSE, kBannerPadding);
30 gtk_container_set_border_width(GTK_CONTAINER(contents), kBannerPadding);
31 gtk_container_add(GTK_CONTAINER(banner_widget_), contents);
32 GtkWidget* warning_image =
33 gtk_image_new_from_stock(GTK_STOCK_DIALOG_WARNING,
34 GTK_ICON_SIZE_SMALL_TOOLBAR);
35 gtk_box_pack_start(GTK_BOX(contents), warning_image, FALSE, FALSE, 0);
36 std::string info_text(l10n_util::GetStringUTF8(IDS_OPTIONS_MANAGED_PREFS));
37 GtkWidget* info_label = gtk_label_new(info_text.c_str());
38 gtk_box_pack_start(GTK_BOX(contents), info_label, FALSE, FALSE, 0);
39 gtk_widget_show_all(banner_widget_);
40 gtk_widget_set_no_show_all(GTK_WIDGET(banner_widget_), TRUE);
41 }
42
43 void ManagedPrefsBannerGtk::OnUpdateVisibility() {
44 DCHECK(banner_widget_);
45 if (DetermineVisibility())
46 gtk_widget_show(banner_widget_);
47 else
48 gtk_widget_hide(banner_widget_);
49 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/options/managed_prefs_banner_gtk.h ('k') | chrome/browser/gtk/options/options_layout_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698