| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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( | 25 SetImage( |
| 26 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(IDR_MOBILE)); | 26 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(IDR_MOBILE)); |
| 27 SetTooltipText( | 27 SetTooltipText( |
| 28 l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_TOOLTIP)); | 28 l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_TOOLTIP)); |
| 29 SetVisible(command_updater_->IsCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE)); | 29 SetVisible(command_updater_->IsCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE)); |
| 30 command_updater_->AddCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this); | 30 command_updater_->AddCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this); |
| 31 TouchableLocationBarViewBase::Init(); |
| 31 } | 32 } |
| 32 | 33 |
| 33 ChromeToMobileView::~ChromeToMobileView() { | 34 ChromeToMobileView::~ChromeToMobileView() { |
| 34 command_updater_->RemoveCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this); | 35 command_updater_->RemoveCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this); |
| 35 } | 36 } |
| 36 | 37 |
| 37 void ChromeToMobileView::EnabledStateChangedForCommand(int id, bool enabled) { | 38 void ChromeToMobileView::EnabledStateChangedForCommand(int id, bool enabled) { |
| 38 DCHECK_EQ(id, IDC_CHROME_TO_MOBILE_PAGE); | 39 DCHECK_EQ(id, IDC_CHROME_TO_MOBILE_PAGE); |
| 39 if (enabled != visible()) { | 40 if (enabled != visible()) { |
| 40 SetVisible(enabled); | 41 SetVisible(enabled); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 67 } | 68 } |
| 68 | 69 |
| 69 bool ChromeToMobileView::OnKeyPressed(const views::KeyEvent& event) { | 70 bool ChromeToMobileView::OnKeyPressed(const views::KeyEvent& event) { |
| 70 if (event.key_code() == ui::VKEY_SPACE || | 71 if (event.key_code() == ui::VKEY_SPACE || |
| 71 event.key_code() == ui::VKEY_RETURN) { | 72 event.key_code() == ui::VKEY_RETURN) { |
| 72 command_updater_->ExecuteCommand(IDC_CHROME_TO_MOBILE_PAGE); | 73 command_updater_->ExecuteCommand(IDC_CHROME_TO_MOBILE_PAGE); |
| 73 return true; | 74 return true; |
| 74 } | 75 } |
| 75 return false; | 76 return false; |
| 76 } | 77 } |
| OLD | NEW |