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

Side by Side Diff: chrome/browser/ui/gtk/browser_toolbar_gtk.cc

Issue 8919017: Split UserMetrics into API vs. implementation. Move API to content/public. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Version for commit (merged again). Created 9 years 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 25 matching lines...) Expand all
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/browser/tab_contents/tab_contents.h" 45 #include "content/browser/tab_contents/tab_contents.h"
46 #include "content/browser/user_metrics.h"
47 #include "content/public/browser/notification_details.h" 46 #include "content/public/browser/notification_details.h"
48 #include "content/public/browser/notification_service.h" 47 #include "content/public/browser/notification_service.h"
48 #include "content/public/browser/user_metrics.h"
49 #include "grit/chromium_strings.h" 49 #include "grit/chromium_strings.h"
50 #include "grit/generated_resources.h" 50 #include "grit/generated_resources.h"
51 #include "grit/theme_resources.h" 51 #include "grit/theme_resources.h"
52 #include "grit/theme_resources_standard.h" 52 #include "grit/theme_resources_standard.h"
53 #include "ui/base/accelerators/accelerator_gtk.h" 53 #include "ui/base/accelerators/accelerator_gtk.h"
54 #include "ui/base/dragdrop/gtk_dnd_util.h" 54 #include "ui/base/dragdrop/gtk_dnd_util.h"
55 #include "ui/base/l10n/l10n_util.h" 55 #include "ui/base/l10n/l10n_util.h"
56 #include "ui/base/resource/resource_bundle.h" 56 #include "ui/base/resource/resource_bundle.h"
57 #include "ui/gfx/canvas_skia_paint.h" 57 #include "ui/gfx/canvas_skia_paint.h"
58 #include "ui/gfx/gtk_util.h" 58 #include "ui/gfx/gtk_util.h"
59 #include "ui/gfx/image/cairo_cached_surface.h" 59 #include "ui/gfx/image/cairo_cached_surface.h"
60 #include "ui/gfx/skbitmap_operations.h" 60 #include "ui/gfx/skbitmap_operations.h"
61 61
62 using content::UserMetricsAction;
63
62 namespace { 64 namespace {
63 65
64 // Padding on left and right of the left toolbar buttons (back, forward, reload, 66 // Padding on left and right of the left toolbar buttons (back, forward, reload,
65 // etc.). 67 // etc.).
66 const int kToolbarLeftAreaPadding = 4; 68 const int kToolbarLeftAreaPadding = 4;
67 69
68 // Height of the toolbar in pixels (not counting padding). 70 // Height of the toolbar in pixels (not counting padding).
69 const int kToolbarHeight = 29; 71 const int kToolbarHeight = 29;
70 72
71 // Padding within the toolbar above the buttons and location bar. 73 // Padding within the toolbar above the buttons and location bar.
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 0, 0); 286 0, 0);
285 } 287 }
286 288
287 void BrowserToolbarGtk::ShowAppMenu() { 289 void BrowserToolbarGtk::ShowAppMenu() {
288 wrench_menu_->Cancel(); 290 wrench_menu_->Cancel();
289 291
290 if (!is_wrench_menu_model_valid_) 292 if (!is_wrench_menu_model_valid_)
291 RebuildWrenchMenu(); 293 RebuildWrenchMenu();
292 294
293 wrench_menu_button_->SetPaintOverride(GTK_STATE_ACTIVE); 295 wrench_menu_button_->SetPaintOverride(GTK_STATE_ACTIVE);
294 UserMetrics::RecordAction(UserMetricsAction("ShowAppMenu")); 296 content::RecordAction(UserMetricsAction("ShowAppMenu"));
295 wrench_menu_->PopupAsFromKeyEvent(wrench_menu_button_->widget()); 297 wrench_menu_->PopupAsFromKeyEvent(wrench_menu_button_->widget());
296 } 298 }
297 299
298 // CommandUpdater::CommandObserver --------------------------------------------- 300 // CommandUpdater::CommandObserver ---------------------------------------------
299 301
300 void BrowserToolbarGtk::EnabledStateChangedForCommand(int id, bool enabled) { 302 void BrowserToolbarGtk::EnabledStateChangedForCommand(int id, bool enabled) {
301 GtkWidget* widget = NULL; 303 GtkWidget* widget = NULL;
302 switch (id) { 304 switch (id) {
303 case IDC_BACK: 305 case IDC_BACK:
304 widget = back_->widget(); 306 widget = back_->widget();
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 const SkBitmap* badge = theme_service_->GetBitmapNamed(resource_id); 679 const SkBitmap* badge = theme_service_->GetBitmapNamed(resource_id);
678 gfx::CanvasSkiaPaint canvas(expose, false); 680 gfx::CanvasSkiaPaint canvas(expose, false);
679 int x_offset = base::i18n::IsRTL() ? 0 : allocation.width - badge->width(); 681 int x_offset = base::i18n::IsRTL() ? 0 : allocation.width - badge->width();
680 int y_offset = 0; 682 int y_offset = 0;
681 canvas.DrawBitmapInt(*badge, 683 canvas.DrawBitmapInt(*badge,
682 allocation.x + x_offset, 684 allocation.x + x_offset,
683 allocation.y + y_offset); 685 allocation.y + y_offset);
684 686
685 return FALSE; 687 return FALSE;
686 } 688 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc ('k') | chrome/browser/ui/gtk/gtk_theme_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698