summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/status/feedback_menu_button.cc
blob: 1b8ead609d98030803619ca933145b01903f1b5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/chromeos/status/feedback_menu_button.h"

#include <string>

#include "app/resource_bundle.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/chromeos/status/status_area_host.h"
#include "gfx/canvas.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"

namespace chromeos {

////////////////////////////////////////////////////////////////////////////////
// LanguageMenuButton

FeedbackMenuButton::FeedbackMenuButton(StatusAreaHost* host)
    : StatusAreaButton(this),
      host_(host) {
  DCHECK(host_);
}

FeedbackMenuButton::~FeedbackMenuButton() {
}

////////////////////////////////////////////////////////////////////////////////
// FeedbackMenuButton, StatusAreaButton implementation:

void FeedbackMenuButton::DrawPressed(gfx::Canvas* canvas) {
  DrawFeedbackIcon(canvas, *ResourceBundle::GetSharedInstance().
      GetBitmapNamed(IDR_STATUSBAR_FEEDBACK_PRESSED));
}

void FeedbackMenuButton::DrawIcon(gfx::Canvas* canvas) {
  DrawFeedbackIcon(canvas, *ResourceBundle::GetSharedInstance().
      GetBitmapNamed(IDR_STATUSBAR_FEEDBACK));
}

void FeedbackMenuButton::DrawFeedbackIcon(gfx::Canvas* canvas, SkBitmap icon) {
  // Draw the battery icon 5 pixels down to center it.
  static const int kIconVerticalPadding = 5;
  canvas->DrawBitmapInt(icon, 0, kIconVerticalPadding);
}

////////////////////////////////////////////////////////////////////////////////
// PowerMenuButton, views::ViewMenuDelegate implementation:

void FeedbackMenuButton::RunMenu(views::View* source, const gfx::Point& pt) {
  DCHECK(host_);
  host_->ExecuteBrowserCommand(IDC_REPORT_BUG);
}

}  // namespace chromeos