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/views/location_bar/chrome_to_mobile_view.h" | 5 #include "chrome/browser/ui/views/location_bar/chrome_to_mobile_view.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/ui/view_ids.h" | 9 #include "chrome/browser/ui/view_ids.h" |
10 #include "chrome/browser/ui/views/browser_dialogs.h" | 10 #include "chrome/browser/ui/views/browser_dialogs.h" |
11 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 11 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
13 #include "grit/theme_resources_standard.h" | 13 #include "grit/theme_resources_standard.h" |
14 #include "ui/base/accessibility/accessible_view_state.h" | 14 #include "ui/base/accessibility/accessible_view_state.h" |
15 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
16 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
17 | 17 |
18 ChromeToMobileView::ChromeToMobileView( | 18 ChromeToMobileView::ChromeToMobileView( |
19 LocationBarView* location_bar_view, | 19 LocationBarView* location_bar_view, |
20 CommandUpdater* command_updater) | 20 CommandUpdater* command_updater) |
21 : location_bar_view_(location_bar_view), | 21 : location_bar_view_(location_bar_view), |
22 command_updater_(command_updater) { | 22 command_updater_(command_updater) { |
23 set_id(VIEW_ID_CHROME_TO_MOBILE_BUTTON); | 23 set_id(VIEW_ID_CHROME_TO_MOBILE_BUTTON); |
24 set_accessibility_focusable(true); | 24 set_accessibility_focusable(true); |
25 SetImage(ui::ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_MOBILE)); | 25 SetImage( |
| 26 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(IDR_MOBILE)); |
26 SetTooltipText( | 27 SetTooltipText( |
27 l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_TOOLTIP)); | 28 l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_TOOLTIP)); |
28 SetVisible(command_updater_->IsCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE)); | 29 SetVisible(command_updater_->IsCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE)); |
29 command_updater_->AddCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this); | 30 command_updater_->AddCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this); |
30 } | 31 } |
31 | 32 |
32 ChromeToMobileView::~ChromeToMobileView() { | 33 ChromeToMobileView::~ChromeToMobileView() { |
33 command_updater_->RemoveCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this); | 34 command_updater_->RemoveCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this); |
34 } | 35 } |
35 | 36 |
(...skipping 30 matching lines...) Expand all Loading... |
66 } | 67 } |
67 | 68 |
68 bool ChromeToMobileView::OnKeyPressed(const views::KeyEvent& event) { | 69 bool ChromeToMobileView::OnKeyPressed(const views::KeyEvent& event) { |
69 if (event.key_code() == ui::VKEY_SPACE || | 70 if (event.key_code() == ui::VKEY_SPACE || |
70 event.key_code() == ui::VKEY_RETURN) { | 71 event.key_code() == ui::VKEY_RETURN) { |
71 command_updater_->ExecuteCommand(IDC_CHROME_TO_MOBILE_PAGE); | 72 command_updater_->ExecuteCommand(IDC_CHROME_TO_MOBILE_PAGE); |
72 return true; | 73 return true; |
73 } | 74 } |
74 return false; | 75 return false; |
75 } | 76 } |
OLD | NEW |