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

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

Issue 265713007: views: Update event-related API to use PointF/RectF instead of Point/Rect. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 DCHECK_EQ(search_button_, sender); 1494 DCHECK_EQ(search_button_, sender);
1495 // TODO(pkasting): When macourteau adds UMA stats for this, wire them up here. 1495 // TODO(pkasting): When macourteau adds UMA stats for this, wire them up here.
1496 omnibox_view_->model()->AcceptInput( 1496 omnibox_view_->model()->AcceptInput(
1497 ui::DispositionFromEventFlags(event.flags()), false); 1497 ui::DispositionFromEventFlags(event.flags()), false);
1498 } 1498 }
1499 1499
1500 //////////////////////////////////////////////////////////////////////////////// 1500 ////////////////////////////////////////////////////////////////////////////////
1501 // LocationBarView, private views::DragController implementation: 1501 // LocationBarView, private views::DragController implementation:
1502 1502
1503 void LocationBarView::WriteDragDataForView(views::View* sender, 1503 void LocationBarView::WriteDragDataForView(views::View* sender,
1504 const gfx::Point& press_pt, 1504 const gfx::PointF& press_pt,
1505 OSExchangeData* data) { 1505 OSExchangeData* data) {
1506 DCHECK_NE(GetDragOperationsForView(sender, press_pt), 1506 DCHECK_NE(GetDragOperationsForView(sender, press_pt),
1507 ui::DragDropTypes::DRAG_NONE); 1507 ui::DragDropTypes::DRAG_NONE);
1508 1508
1509 WebContents* web_contents = GetWebContents(); 1509 WebContents* web_contents = GetWebContents();
1510 FaviconTabHelper* favicon_tab_helper = 1510 FaviconTabHelper* favicon_tab_helper =
1511 FaviconTabHelper::FromWebContents(web_contents); 1511 FaviconTabHelper::FromWebContents(web_contents);
1512 gfx::ImageSkia favicon = favicon_tab_helper->GetFavicon().AsImageSkia(); 1512 gfx::ImageSkia favicon = favicon_tab_helper->GetFavicon().AsImageSkia();
1513 button_drag_utils::SetURLAndDragImage(web_contents->GetURL(), 1513 button_drag_utils::SetURLAndDragImage(web_contents->GetURL(),
1514 web_contents->GetTitle(), 1514 web_contents->GetTitle(),
1515 favicon, 1515 favicon,
1516 data, 1516 data,
1517 sender->GetWidget()); 1517 sender->GetWidget());
1518 } 1518 }
1519 1519
1520 int LocationBarView::GetDragOperationsForView(views::View* sender, 1520 int LocationBarView::GetDragOperationsForView(views::View* sender,
1521 const gfx::Point& p) { 1521 const gfx::PointF& p) {
1522 DCHECK((sender == location_icon_view_) || (sender == ev_bubble_view_) || 1522 DCHECK((sender == location_icon_view_) || (sender == ev_bubble_view_) ||
1523 (sender == origin_chip_view_)); 1523 (sender == origin_chip_view_));
1524 WebContents* web_contents = delegate_->GetWebContents(); 1524 WebContents* web_contents = delegate_->GetWebContents();
1525 return (web_contents && web_contents->GetURL().is_valid() && 1525 return (web_contents && web_contents->GetURL().is_valid() &&
1526 (!GetOmniboxView()->IsEditingOrEmpty() || 1526 (!GetOmniboxView()->IsEditingOrEmpty() ||
1527 sender == origin_chip_view_)) ? 1527 sender == origin_chip_view_)) ?
1528 (ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK) : 1528 (ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK) :
1529 ui::DragDropTypes::DRAG_NONE; 1529 ui::DragDropTypes::DRAG_NONE;
1530 } 1530 }
1531 1531
1532 bool LocationBarView::CanStartDragForView(View* sender, 1532 bool LocationBarView::CanStartDragForView(View* sender,
1533 const gfx::Point& press_pt, 1533 const gfx::PointF& press_pt,
1534 const gfx::Point& p) { 1534 const gfx::PointF& p) {
1535 return true; 1535 return true;
1536 } 1536 }
1537 1537
1538 //////////////////////////////////////////////////////////////////////////////// 1538 ////////////////////////////////////////////////////////////////////////////////
1539 // LocationBarView, private OmniboxEditController implementation: 1539 // LocationBarView, private OmniboxEditController implementation:
1540 1540
1541 void LocationBarView::OnChanged() { 1541 void LocationBarView::OnChanged() {
1542 int icon_id = omnibox_view_->GetIcon(); 1542 int icon_id = omnibox_view_->GetIcon();
1543 location_icon_view_->SetImage(GetThemeProvider()->GetImageSkiaNamed(icon_id)); 1543 location_icon_view_->SetImage(GetThemeProvider()->GetImageSkiaNamed(icon_id));
1544 location_icon_view_->ShowTooltip(!GetOmniboxView()->IsEditingOrEmpty()); 1544 location_icon_view_->ShowTooltip(!GetOmniboxView()->IsEditingOrEmpty());
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 void LocationBarView::ModelChanged(const SearchModel::State& old_state, 1659 void LocationBarView::ModelChanged(const SearchModel::State& old_state,
1660 const SearchModel::State& new_state) { 1660 const SearchModel::State& new_state) {
1661 const bool visible = !GetToolbarModel()->input_in_progress() && 1661 const bool visible = !GetToolbarModel()->input_in_progress() &&
1662 new_state.voice_search_supported; 1662 new_state.voice_search_supported;
1663 if (mic_search_view_->visible() != visible) { 1663 if (mic_search_view_->visible() != visible) {
1664 mic_search_view_->SetVisible(visible); 1664 mic_search_view_->SetVisible(visible);
1665 Layout(); 1665 Layout();
1666 } 1666 }
1667 } 1667 }
1668 1668
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698