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

Side by Side Diff: chrome/browser/gtk/location_bar_view_gtk.cc

Issue 150176: GTK: First draft of using native themes, partially based on evan's CL 118358. (Closed)
Patch Set: And the codereview tool is back. Created 11 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/gtk/location_bar_view_gtk.h" 5 #include "chrome/browser/gtk/location_bar_view_gtk.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "app/resource_bundle.h" 9 #include "app/resource_bundle.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/gfx/gtk_util.h" 11 #include "base/gfx/gtk_util.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "chrome/app/chrome_dll_resource.h" 14 #include "chrome/app/chrome_dll_resource.h"
15 #include "chrome/browser/alternate_nav_url_fetcher.h" 15 #include "chrome/browser/alternate_nav_url_fetcher.h"
16 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" 16 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h"
17 #include "chrome/browser/command_updater.h" 17 #include "chrome/browser/command_updater.h"
18 #include "chrome/browser/gtk/gtk_theme_provider.h"
18 #include "chrome/browser/tab_contents/tab_contents.h" 19 #include "chrome/browser/tab_contents/tab_contents.h"
19 #include "chrome/common/gtk_util.h" 20 #include "chrome/common/gtk_util.h"
20 #include "chrome/common/page_transition_types.h" 21 #include "chrome/common/page_transition_types.h"
21 #include "third_party/skia/include/core/SkBitmap.h" 22 #include "third_party/skia/include/core/SkBitmap.h"
22 #include "webkit/glue/window_open_disposition.h" 23 #include "webkit/glue/window_open_disposition.h"
23 24
24 namespace { 25 namespace {
25 26
26 // Top and bottom padding/margin 27 // Top and bottom padding/margin
27 // We are positioned with a little bit of extra space that we don't use now. 28 // We are positioned with a little bit of extra space that we don't use now.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 110
110 info_label_ = gtk_label_new(NULL); 111 info_label_ = gtk_label_new(NULL);
111 gtk_widget_modify_base(info_label_, GTK_STATE_NORMAL, 112 gtk_widget_modify_base(info_label_, GTK_STATE_NORMAL,
112 &LocationBarViewGtk::kBackgroundColorByLevel[0]); 113 &LocationBarViewGtk::kBackgroundColorByLevel[0]);
113 gtk_widget_hide(GTK_WIDGET(info_label_)); 114 gtk_widget_hide(GTK_WIDGET(info_label_));
114 115
115 g_signal_connect(hbox_.get(), "expose-event", 116 g_signal_connect(hbox_.get(), "expose-event",
116 G_CALLBACK(&HandleExposeThunk), this); 117 G_CALLBACK(&HandleExposeThunk), this);
117 118
118 GtkWidget* align = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); 119 GtkWidget* align = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
119 gtk_alignment_set_padding(GTK_ALIGNMENT(align), 120 // TODO(erg): Redo this so that it adjusts during theme changes.
120 kTopMargin + kBorderThickness, 121 if (GtkThemeProvider::UseSystemThemeGraphics(profile_)) {
121 kBottomMargin + kBorderThickness, 122 gtk_alignment_set_padding(GTK_ALIGNMENT(align),
122 kEditLeftRightPadding, kEditLeftRightPadding); 123 0, 0,
124 kEditLeftRightPadding, kEditLeftRightPadding);
125 } else {
126 gtk_alignment_set_padding(GTK_ALIGNMENT(align),
127 kTopMargin + kBorderThickness,
128 kBottomMargin + kBorderThickness,
129 kEditLeftRightPadding, kEditLeftRightPadding);
130 }
123 gtk_container_add(GTK_CONTAINER(align), location_entry_->widget()); 131 gtk_container_add(GTK_CONTAINER(align), location_entry_->widget());
124 gtk_box_pack_start(GTK_BOX(hbox_.get()), align, TRUE, TRUE, 0); 132 gtk_box_pack_start(GTK_BOX(hbox_.get()), align, TRUE, TRUE, 0);
125 133
126 // Pack info_label_ and security icons in hbox. We hide/show them 134 // Pack info_label_ and security icons in hbox. We hide/show them
127 // by SetSecurityIcon() and SetInfoText(). 135 // by SetSecurityIcon() and SetInfoText().
128 info_label_align_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); 136 info_label_align_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
129 gtk_alignment_set_padding(GTK_ALIGNMENT(info_label_align_), 137 gtk_alignment_set_padding(GTK_ALIGNMENT(info_label_align_),
130 kTopMargin + kBorderThickness, 138 kTopMargin + kBorderThickness,
131 kBottomMargin + kBorderThickness, 139 kBottomMargin + kBorderThickness,
132 0, kEvTextPaddingRight); 140 0, kEvTextPaddingRight);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 } else { 355 } else {
348 DCHECK_EQ(info_text_type, ToolbarModel::INFO_NO_INFO); 356 DCHECK_EQ(info_text_type, ToolbarModel::INFO_NO_INFO);
349 DCHECK(info_text.empty()); 357 DCHECK(info_text.empty());
350 // Clear info_text. Should we reset the fg here? 358 // Clear info_text. Should we reset the fg here?
351 gtk_widget_hide(GTK_WIDGET(info_label_align_)); 359 gtk_widget_hide(GTK_WIDGET(info_label_align_));
352 } 360 }
353 gtk_label_set_text(GTK_LABEL(info_label_), WideToUTF8(info_text).c_str()); 361 gtk_label_set_text(GTK_LABEL(info_label_), WideToUTF8(info_text).c_str());
354 gtk_widget_set_tooltip_text(GTK_WIDGET(info_label_), 362 gtk_widget_set_tooltip_text(GTK_WIDGET(info_label_),
355 WideToUTF8(info_tooltip).c_str()); 363 WideToUTF8(info_tooltip).c_str());
356 } 364 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698