| OLD | NEW |
| 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/chromeos/status/feedback_menu_button.h" | 5 #include "chrome/browser/chromeos/status/feedback_menu_button.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| 11 #include "chrome/app/chrome_dll_resource.h" | 11 #include "chrome/app/chrome_dll_resource.h" |
| 12 #include "chrome/browser/chromeos/status/status_area_host.h" | 12 #include "chrome/browser/chromeos/status/status_area_host.h" |
| 13 #include "gfx/canvas.h" | 13 #include "gfx/canvas.h" |
| 14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 15 #include "grit/theme_resources.h" | 15 #include "grit/theme_resources.h" |
| 16 | 16 |
| 17 namespace chromeos { | 17 namespace chromeos { |
| 18 | 18 |
| 19 //////////////////////////////////////////////////////////////////////////////// | 19 //////////////////////////////////////////////////////////////////////////////// |
| 20 // FeedbackMenuButton | 20 // FeedbackMenuButton |
| 21 | 21 |
| 22 FeedbackMenuButton::FeedbackMenuButton(StatusAreaHost* host) | 22 FeedbackMenuButton::FeedbackMenuButton(StatusAreaHost* host) |
| 23 : StatusAreaButton(this), | 23 : StatusAreaButton(this), |
| 24 host_(host) { | 24 host_(host) { |
| 25 DCHECK(host_); | 25 DCHECK(host_); |
| 26 SetTooltipText(l10n_util::GetString(IDS_STATUSBAR_FEEDBACK_TOOLTIP)); | 26 SetTooltipText(l10n_util::GetString(IDS_STATUSBAR_FEEDBACK_TOOLTIP)); |
| 27 SetIcon(*ResourceBundle::GetSharedInstance(). |
| 28 GetBitmapNamed(IDR_STATUSBAR_FEEDBACK)); |
| 27 } | 29 } |
| 28 | 30 |
| 29 FeedbackMenuButton::~FeedbackMenuButton() { | 31 FeedbackMenuButton::~FeedbackMenuButton() { |
| 30 } | 32 } |
| 31 | 33 |
| 32 //////////////////////////////////////////////////////////////////////////////// | 34 //////////////////////////////////////////////////////////////////////////////// |
| 33 // FeedbackMenuButton, StatusAreaButton implementation: | |
| 34 | |
| 35 void FeedbackMenuButton::DrawPressed(gfx::Canvas* canvas) { | |
| 36 DrawFeedbackIcon(canvas, *ResourceBundle::GetSharedInstance(). | |
| 37 GetBitmapNamed(IDR_STATUSBAR_FEEDBACK_PRESSED)); | |
| 38 } | |
| 39 | |
| 40 void FeedbackMenuButton::DrawIcon(gfx::Canvas* canvas) { | |
| 41 DrawFeedbackIcon(canvas, *ResourceBundle::GetSharedInstance(). | |
| 42 GetBitmapNamed(IDR_STATUSBAR_FEEDBACK)); | |
| 43 } | |
| 44 | |
| 45 void FeedbackMenuButton::DrawFeedbackIcon(gfx::Canvas* canvas, SkBitmap icon) { | |
| 46 // Draw the battery icon 5 pixels down to center it. | |
| 47 static const int kIconVerticalPadding = 5; | |
| 48 canvas->DrawBitmapInt(icon, 0, kIconVerticalPadding); | |
| 49 } | |
| 50 | |
| 51 //////////////////////////////////////////////////////////////////////////////// | |
| 52 // PowerMenuButton, views::ViewMenuDelegate implementation: | 35 // PowerMenuButton, views::ViewMenuDelegate implementation: |
| 53 | 36 |
| 54 void FeedbackMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { | 37 void FeedbackMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { |
| 55 DCHECK(host_); | 38 DCHECK(host_); |
| 56 host_->ExecuteBrowserCommand(IDC_REPORT_BUG); | 39 host_->ExecuteBrowserCommand(IDC_REPORT_BUG); |
| 57 } | 40 } |
| 58 | 41 |
| 59 } // namespace chromeos | 42 } // namespace chromeos |
| OLD | NEW |