Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: chrome/browser/ui/views/location_bar/chrome_to_mobile_view.cc

Issue 10519008: Enlarge size of touch target for several location bar buttons without affecting visual layout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pure merge to LKGR Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 TouchableLocationBarView::Init(this);
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);
41 location_bar_view_->Update(NULL); 42 location_bar_view_->Update(NULL);
42 } 43 }
43 } 44 }
44 45
46 int ChromeToMobileView::GetBuiltInHorizontalPadding() const {
47 return GetBuiltInHorizontalPaddingImpl();
48 }
49
45 void ChromeToMobileView::GetAccessibleState(ui::AccessibleViewState* state) { 50 void ChromeToMobileView::GetAccessibleState(ui::AccessibleViewState* state) {
46 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_CHROME_TO_MOBILE); 51 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_CHROME_TO_MOBILE);
47 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; 52 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON;
48 } 53 }
49 54
50 bool ChromeToMobileView::GetTooltipText(const gfx::Point& p, 55 bool ChromeToMobileView::GetTooltipText(const gfx::Point& p,
51 string16* tooltip) const { 56 string16* tooltip) const {
52 // Don't show tooltip to distract user if ChromeToMobileBubbleView is showing. 57 // Don't show tooltip to distract user if ChromeToMobileBubbleView is showing.
53 if (browser::IsChromeToMobileBubbleViewShowing()) 58 if (browser::IsChromeToMobileBubbleViewShowing())
54 return false; 59 return false;
(...skipping 12 matching lines...) Expand all
67 } 72 }
68 73
69 bool ChromeToMobileView::OnKeyPressed(const views::KeyEvent& event) { 74 bool ChromeToMobileView::OnKeyPressed(const views::KeyEvent& event) {
70 if (event.key_code() == ui::VKEY_SPACE || 75 if (event.key_code() == ui::VKEY_SPACE ||
71 event.key_code() == ui::VKEY_RETURN) { 76 event.key_code() == ui::VKEY_RETURN) {
72 command_updater_->ExecuteCommand(IDC_CHROME_TO_MOBILE_PAGE); 77 command_updater_->ExecuteCommand(IDC_CHROME_TO_MOBILE_PAGE);
73 return true; 78 return true;
74 } 79 }
75 return false; 80 return false;
76 } 81 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698