| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/chromeos/status/feedback_menu_button.h" | |
| 6 | |
| 7 #include <string> | |
| 8 | |
| 9 #include "app/resource_bundle.h" | |
| 10 #include "chrome/app/chrome_dll_resource.h" | |
| 11 #include "chrome/browser/chromeos/status/status_area_host.h" | |
| 12 #include "gfx/canvas.h" | |
| 13 #include "grit/generated_resources.h" | |
| 14 #include "grit/theme_resources.h" | |
| 15 | |
| 16 namespace chromeos { | |
| 17 | |
| 18 //////////////////////////////////////////////////////////////////////////////// | |
| 19 // LanguageMenuButton | |
| 20 | |
| 21 FeedbackMenuButton::FeedbackMenuButton(StatusAreaHost* host) | |
| 22 : StatusAreaButton(this), | |
| 23 host_(host) { | |
| 24 DCHECK(host_); | |
| 25 } | |
| 26 | |
| 27 FeedbackMenuButton::~FeedbackMenuButton() { | |
| 28 } | |
| 29 | |
| 30 //////////////////////////////////////////////////////////////////////////////// | |
| 31 // FeedbackMenuButton, StatusAreaButton implementation: | |
| 32 | |
| 33 void FeedbackMenuButton::DrawPressed(gfx::Canvas* canvas) { | |
| 34 DrawFeedbackIcon(canvas, *ResourceBundle::GetSharedInstance(). | |
| 35 GetBitmapNamed(IDR_STATUSBAR_FEEDBACK_PRESSED)); | |
| 36 } | |
| 37 | |
| 38 void FeedbackMenuButton::DrawIcon(gfx::Canvas* canvas) { | |
| 39 DrawFeedbackIcon(canvas, *ResourceBundle::GetSharedInstance(). | |
| 40 GetBitmapNamed(IDR_STATUSBAR_FEEDBACK)); | |
| 41 } | |
| 42 | |
| 43 void FeedbackMenuButton::DrawFeedbackIcon(gfx::Canvas* canvas, SkBitmap icon) { | |
| 44 // Draw the battery icon 5 pixels down to center it. | |
| 45 static const int kIconVerticalPadding = 5; | |
| 46 canvas->DrawBitmapInt(icon, 0, kIconVerticalPadding); | |
| 47 } | |
| 48 | |
| 49 //////////////////////////////////////////////////////////////////////////////// | |
| 50 // PowerMenuButton, views::ViewMenuDelegate implementation: | |
| 51 | |
| 52 void FeedbackMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { | |
| 53 DCHECK(host_); | |
| 54 host_->ExecuteBrowserCommand(IDC_REPORT_BUG); | |
| 55 } | |
| 56 | |
| 57 } // namespace chromeos | |
| 58 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | |
| 59 // Use of this source code is governed by a BSD-style license that can be | |
| 60 // found in the LICENSE file. | |
| 61 | |
| 62 #include "chrome/browser/chromeos/status/feedback_menu_button.h" | |
| 63 | |
| 64 #include <string> | |
| 65 | |
| 66 #include "app/resource_bundle.h" | |
| 67 #include "chrome/app/chrome_dll_resource.h" | |
| 68 #include "chrome/browser/chromeos/status/status_area_host.h" | |
| 69 #include "gfx/canvas.h" | |
| 70 #include "grit/generated_resources.h" | |
| 71 #include "grit/theme_resources.h" | |
| 72 | |
| 73 namespace chromeos { | |
| 74 | |
| 75 //////////////////////////////////////////////////////////////////////////////// | |
| 76 // LanguageMenuButton | |
| 77 | |
| 78 FeedbackMenuButton::FeedbackMenuButton(StatusAreaHost* host) | |
| 79 : StatusAreaButton(this), | |
| 80 host_(host) { | |
| 81 DCHECK(host_); | |
| 82 } | |
| 83 | |
| 84 FeedbackMenuButton::~FeedbackMenuButton() { | |
| 85 } | |
| 86 | |
| 87 //////////////////////////////////////////////////////////////////////////////// | |
| 88 // FeedbackMenuButton, StatusAreaButton implementation: | |
| 89 | |
| 90 void FeedbackMenuButton::DrawPressed(gfx::Canvas* canvas) { | |
| 91 DrawFeedbackIcon(canvas, *ResourceBundle::GetSharedInstance(). | |
| 92 GetBitmapNamed(IDR_STATUSBAR_FEEDBACK_PRESSED)); | |
| 93 } | |
| 94 | |
| 95 void FeedbackMenuButton::DrawIcon(gfx::Canvas* canvas) { | |
| 96 DrawFeedbackIcon(canvas, *ResourceBundle::GetSharedInstance(). | |
| 97 GetBitmapNamed(IDR_STATUSBAR_FEEDBACK)); | |
| 98 } | |
| 99 | |
| 100 void FeedbackMenuButton::DrawFeedbackIcon(gfx::Canvas* canvas, SkBitmap icon) { | |
| 101 static const int kIconVerticalPadding = 5; | |
| 102 canvas->DrawBitmapInt(icon, 0, kIconVerticalPadding); | |
| 103 } | |
| 104 | |
| 105 //////////////////////////////////////////////////////////////////////////////// | |
| 106 // PowerMenuButton, views::ViewMenuDelegate implementation: | |
| 107 | |
| 108 void FeedbackMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { | |
| 109 DCHECK(host_); | |
| 110 host_->ExecuteBrowserCommand(IDC_REPORT_BUG); | |
| 111 } | |
| 112 | |
| 113 } // namespace chromeos | |
| OLD | NEW |