OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/gtk/browser_toolbar_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" |
6 | 6 |
7 #include <X11/XF86keysym.h> | 7 #include <X11/XF86keysym.h> |
8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" | 35 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
36 #include "chrome/browser/ui/gtk/reload_button_gtk.h" | 36 #include "chrome/browser/ui/gtk/reload_button_gtk.h" |
37 #include "chrome/browser/ui/gtk/rounded_window.h" | 37 #include "chrome/browser/ui/gtk/rounded_window.h" |
38 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" | 38 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" |
39 #include "chrome/browser/ui/gtk/view_id_util.h" | 39 #include "chrome/browser/ui/gtk/view_id_util.h" |
40 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" | 40 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" |
41 #include "chrome/browser/upgrade_detector.h" | 41 #include "chrome/browser/upgrade_detector.h" |
42 #include "chrome/common/chrome_notification_types.h" | 42 #include "chrome/common/chrome_notification_types.h" |
43 #include "chrome/common/pref_names.h" | 43 #include "chrome/common/pref_names.h" |
44 #include "chrome/common/url_constants.h" | 44 #include "chrome/common/url_constants.h" |
| 45 #include "content/public/browser/host_zoom_map.h" |
45 #include "content/public/browser/notification_details.h" | 46 #include "content/public/browser/notification_details.h" |
46 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
47 #include "content/public/browser/user_metrics.h" | 48 #include "content/public/browser/user_metrics.h" |
48 #include "content/public/browser/web_contents.h" | 49 #include "content/public/browser/web_contents.h" |
49 #include "grit/chromium_strings.h" | 50 #include "grit/chromium_strings.h" |
50 #include "grit/generated_resources.h" | 51 #include "grit/generated_resources.h" |
51 #include "grit/theme_resources.h" | 52 #include "grit/theme_resources.h" |
52 #include "grit/theme_resources_standard.h" | 53 #include "grit/theme_resources_standard.h" |
53 #include "ui/base/accelerators/accelerator_gtk.h" | 54 #include "ui/base/accelerators/accelerator_gtk.h" |
54 #include "ui/base/dragdrop/gtk_dnd_util.h" | 55 #include "ui/base/dragdrop/gtk_dnd_util.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 g_signal_connect_after(wrench_box, "expose-event", | 228 g_signal_connect_after(wrench_box, "expose-event", |
228 G_CALLBACK(OnWrenchMenuButtonExposeThunk), this); | 229 G_CALLBACK(OnWrenchMenuButtonExposeThunk), this); |
229 gtk_container_add(GTK_CONTAINER(wrench_box), wrench_button); | 230 gtk_container_add(GTK_CONTAINER(wrench_box), wrench_button); |
230 gtk_box_pack_start(GTK_BOX(toolbar_), wrench_box, FALSE, FALSE, 4); | 231 gtk_box_pack_start(GTK_BOX(toolbar_), wrench_box, FALSE, FALSE, 4); |
231 | 232 |
232 wrench_menu_.reset(new MenuGtk(this, wrench_menu_model_.get())); | 233 wrench_menu_.reset(new MenuGtk(this, wrench_menu_model_.get())); |
233 // The bookmark menu model needs to be able to force the wrench menu to close. | 234 // The bookmark menu model needs to be able to force the wrench menu to close. |
234 wrench_menu_model_->bookmark_sub_menu_model()->SetMenuGtk(wrench_menu_.get()); | 235 wrench_menu_model_->bookmark_sub_menu_model()->SetMenuGtk(wrench_menu_.get()); |
235 | 236 |
236 registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, | 237 registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, |
237 content::Source<HostZoomMap>(profile->GetHostZoomMap())); | 238 content::Source<HostZoomMap>( |
| 239 HostZoomMap::GetForBrowserContext(profile))); |
238 | 240 |
239 if (ShouldOnlyShowLocation()) { | 241 if (ShouldOnlyShowLocation()) { |
240 gtk_widget_show(event_box_); | 242 gtk_widget_show(event_box_); |
241 gtk_widget_show(alignment_); | 243 gtk_widget_show(alignment_); |
242 gtk_widget_show(toolbar_); | 244 gtk_widget_show(toolbar_); |
243 gtk_widget_show_all(location_hbox_); | 245 gtk_widget_show_all(location_hbox_); |
244 gtk_widget_hide(reload_->widget()); | 246 gtk_widget_hide(reload_->widget()); |
245 } else { | 247 } else { |
246 gtk_widget_show_all(event_box_); | 248 gtk_widget_show_all(event_box_); |
247 if (actions_toolbar_->button_count() == 0) | 249 if (actions_toolbar_->button_count() == 0) |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 const SkBitmap* badge = theme_service_->GetBitmapNamed(resource_id); | 683 const SkBitmap* badge = theme_service_->GetBitmapNamed(resource_id); |
682 gfx::CanvasSkiaPaint canvas(expose, false); | 684 gfx::CanvasSkiaPaint canvas(expose, false); |
683 int x_offset = base::i18n::IsRTL() ? 0 : allocation.width - badge->width(); | 685 int x_offset = base::i18n::IsRTL() ? 0 : allocation.width - badge->width(); |
684 int y_offset = 0; | 686 int y_offset = 0; |
685 canvas.DrawBitmapInt(*badge, | 687 canvas.DrawBitmapInt(*badge, |
686 allocation.x + x_offset, | 688 allocation.x + x_offset, |
687 allocation.y + y_offset); | 689 allocation.y + y_offset); |
688 | 690 |
689 return FALSE; | 691 return FALSE; |
690 } | 692 } |
OLD | NEW |