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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_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/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "ui/base/accessibility/accessible_view_state.h" 57 #include "ui/base/accessibility/accessible_view_state.h"
58 #include "ui/base/dragdrop/drag_drop_types.h" 58 #include "ui/base/dragdrop/drag_drop_types.h"
59 #include "ui/base/l10n/l10n_util.h" 59 #include "ui/base/l10n/l10n_util.h"
60 #include "ui/base/layout.h" 60 #include "ui/base/layout.h"
61 #include "ui/base/resource/resource_bundle.h" 61 #include "ui/base/resource/resource_bundle.h"
62 #include "ui/base/theme_provider.h" 62 #include "ui/base/theme_provider.h"
63 #include "ui/gfx/canvas.h" 63 #include "ui/gfx/canvas.h"
64 #include "ui/gfx/color_utils.h" 64 #include "ui/gfx/color_utils.h"
65 #include "ui/gfx/image/image.h" 65 #include "ui/gfx/image/image.h"
66 #include "ui/gfx/skia_util.h" 66 #include "ui/gfx/skia_util.h"
67 #include "ui/views/border.h"
67 #include "ui/views/button_drag_utils.h" 68 #include "ui/views/button_drag_utils.h"
68 #include "ui/views/controls/label.h" 69 #include "ui/views/controls/label.h"
69 70
70 #if !defined(OS_CHROMEOS) 71 #if !defined(OS_CHROMEOS)
71 #include "chrome/browser/ui/views/first_run_bubble.h" 72 #include "chrome/browser/ui/views/first_run_bubble.h"
72 #endif 73 #endif
73 74
74 75
75 using content::WebContents; 76 using content::WebContents;
76 using views::View; 77 using views::View;
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 offset -= action_box_button_width; 641 offset -= action_box_button_width;
641 action_box_button_view_->SetBounds(offset, location_y, 642 action_box_button_view_->SetBounds(offset, location_y,
642 action_box_button_width, 643 action_box_button_width,
643 location_height); 644 location_height);
644 offset -= GetItemPadding(); 645 offset -= GetItemPadding();
645 } else { 646 } else {
646 offset -= GetEdgeItemPadding(); 647 offset -= GetEdgeItemPadding();
647 } 648 }
648 649
649 if (star_view_ && star_view_->visible()) { 650 if (star_view_ && star_view_->visible()) {
651 offset += star_view_->GetBuiltInHorizontalPadding();
650 int star_width = star_view_->GetPreferredSize().width(); 652 int star_width = star_view_->GetPreferredSize().width();
651 offset -= star_width; 653 offset -= star_width;
652 star_view_->SetBounds(offset, location_y, star_width, location_height); 654 star_view_->SetBounds(offset, location_y, star_width, location_height);
653 offset -= GetItemPadding(); 655 offset -= GetItemPadding() - star_view_->GetBuiltInHorizontalPadding();
654 } 656 }
655 657
656 if (chrome_to_mobile_view_ && chrome_to_mobile_view_->visible()) { 658 if (chrome_to_mobile_view_ && chrome_to_mobile_view_->visible()) {
659 offset += chrome_to_mobile_view_->GetBuiltInHorizontalPadding();
657 int icon_width = chrome_to_mobile_view_->GetPreferredSize().width(); 660 int icon_width = chrome_to_mobile_view_->GetPreferredSize().width();
658 offset -= icon_width; 661 offset -= icon_width;
659 chrome_to_mobile_view_->SetBounds(offset, location_y, 662 chrome_to_mobile_view_->SetBounds(offset, location_y,
660 icon_width, location_height); 663 icon_width, location_height);
661 offset -= GetItemPadding(); 664 offset -= GetItemPadding() -
665 chrome_to_mobile_view_->GetBuiltInHorizontalPadding();
662 } 666 }
663 667
664 for (PageActionViews::const_iterator i(page_action_views_.begin()); 668 for (PageActionViews::const_iterator i(page_action_views_.begin());
665 i != page_action_views_.end(); ++i) { 669 i != page_action_views_.end(); ++i) {
666 if ((*i)->visible()) { 670 if ((*i)->visible()) {
671 offset += (*i)->GetBuiltInHorizontalPadding();
667 int page_action_width = (*i)->GetPreferredSize().width(); 672 int page_action_width = (*i)->GetPreferredSize().width();
668 offset -= page_action_width; 673 offset -= page_action_width;
669 (*i)->SetBounds(offset, location_y, page_action_width, location_height); 674 (*i)->SetBounds(offset, location_y, page_action_width, location_height);
670 offset -= GetItemPadding(); 675 offset -= GetItemPadding() - (*i)->GetBuiltInHorizontalPadding();
671 } 676 }
672 } 677 }
673 // We use a reverse_iterator here because we're laying out the views from 678 // We use a reverse_iterator here because we're laying out the views from
674 // right to left but in the vector they're ordered left to right. 679 // right to left but in the vector they're ordered left to right.
675 for (ContentSettingViews::const_reverse_iterator 680 for (ContentSettingViews::const_reverse_iterator
676 i(content_setting_views_.rbegin()); i != content_setting_views_.rend(); 681 i(content_setting_views_.rbegin()); i != content_setting_views_.rend();
677 ++i) { 682 ++i) {
678 if ((*i)->visible()) { 683 if ((*i)->visible()) {
684 offset += (*i)->GetBuiltInHorizontalPadding();
679 int content_blocked_width = (*i)->GetPreferredSize().width(); 685 int content_blocked_width = (*i)->GetPreferredSize().width();
680 offset -= content_blocked_width; 686 offset -= content_blocked_width;
681 (*i)->SetBounds(offset, location_y, content_blocked_width, 687 (*i)->SetBounds(offset, location_y, content_blocked_width,
682 location_height); 688 location_height);
683 offset -= GetItemPadding(); 689 offset -= GetItemPadding() - (*i)->GetBuiltInHorizontalPadding();
684 } 690 }
685 } 691 }
686 692
687 // Now lay out items to the left of the edit field. 693 // Now lay out items to the left of the edit field.
688 if (location_icon_view_->visible()) { 694 if (location_icon_view_->visible()) {
689 location_icon_view_->SetBounds(kEdgeThickness + GetEdgeItemPadding(), 695 location_icon_view_->SetBounds(
696 kEdgeThickness + GetEdgeItemPadding() -
697 location_icon_view_->GetBuiltInHorizontalPadding(),
690 location_y, location_icon_width, location_height); 698 location_y, location_icon_width, location_height);
691 offset = location_icon_view_->bounds().right() + kItemEditPadding; 699 offset = location_icon_view_->bounds().right() + kItemEditPadding -
700 location_icon_view_->GetBuiltInHorizontalPadding();
692 } else if (ev_bubble_view_->visible()) { 701 } else if (ev_bubble_view_->visible()) {
693 ev_bubble_view_->SetBounds(kEdgeThickness + kBubbleHorizontalPadding, 702 ev_bubble_view_->SetBounds(kEdgeThickness + kBubbleHorizontalPadding,
694 location_y + kBubbleVerticalPadding, ev_bubble_width, 703 location_y + kBubbleVerticalPadding, ev_bubble_width,
695 ev_bubble_view_->GetPreferredSize().height()); 704 ev_bubble_view_->GetPreferredSize().height());
696 offset = ev_bubble_view_->bounds().right() + kItemEditPadding; 705 offset = ev_bubble_view_->bounds().right() + kItemEditPadding;
697 } else { 706 } else {
698 offset = kEdgeThickness + 707 offset = kEdgeThickness +
699 (show_selected_keyword ? kBubbleHorizontalPadding : kEdgeEditPadding); 708 (show_selected_keyword ? kBubbleHorizontalPadding : kEdgeEditPadding);
700 } 709 }
701 710
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 bool LocationBarView::HasValidSuggestText() const { 1351 bool LocationBarView::HasValidSuggestText() const {
1343 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && 1352 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
1344 !suggested_text_view_->text().empty(); 1353 !suggested_text_view_->text().empty();
1345 } 1354 }
1346 1355
1347 #if !defined(USE_AURA) 1356 #if !defined(USE_AURA)
1348 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { 1357 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() {
1349 return static_cast<OmniboxViewWin*>(location_entry_.get()); 1358 return static_cast<OmniboxViewWin*>(location_entry_.get());
1350 } 1359 }
1351 #endif 1360 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698