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

Side by Side Diff: chrome/browser/ui/views/frame/browser_root_view.cc

Issue 16832003: Add UMA metrics to measure the effectiveness of views fuzzing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ifdefs removed Created 7 years, 5 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/frame/browser_root_view.h" 5 #include "chrome/browser/ui/views/frame/browser_root_view.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 9 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
10 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 10 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
11 #include "chrome/browser/autocomplete/autocomplete_match.h" 11 #include "chrome/browser/autocomplete/autocomplete_match.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/omnibox/location_bar.h" 13 #include "chrome/browser/ui/omnibox/location_bar.h"
14 #include "chrome/browser/ui/views/frame/browser_frame.h" 14 #include "chrome/browser/ui/views/frame/browser_frame.h"
15 #include "chrome/browser/ui/views/frame/browser_view.h" 15 #include "chrome/browser/ui/views/frame/browser_view.h"
16 #include "chrome/browser/ui/views/tabs/tab_strip.h" 16 #include "chrome/browser/ui/views/tabs/tab_strip.h"
17 #include "chrome/browser/ui/views/touch_uma/touch_uma.h"
17 #include "chrome/common/chrome_notification_types.h" 18 #include "chrome/common/chrome_notification_types.h"
18 #include "grit/chromium_strings.h" 19 #include "grit/chromium_strings.h"
19 #include "ui/base/accessibility/accessible_view_state.h" 20 #include "ui/base/accessibility/accessible_view_state.h"
20 #include "ui/base/dragdrop/drag_drop_types.h" 21 #include "ui/base/dragdrop/drag_drop_types.h"
21 #include "ui/base/dragdrop/os_exchange_data.h" 22 #include "ui/base/dragdrop/os_exchange_data.h"
22 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
23 24
24 // static 25 // static
25 const char BrowserRootView::kViewClassName[] = 26 const char BrowserRootView::kViewClassName[] =
26 "browser/ui/views/frame/BrowserRootView"; 27 "browser/ui/views/frame/BrowserRootView";
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 forwarding_to_tab_strip_ = false; 113 forwarding_to_tab_strip_ = false;
113 scoped_ptr<ui::DropTargetEvent> mapped_event( 114 scoped_ptr<ui::DropTargetEvent> mapped_event(
114 MapEventToTabStrip(event, mapped_data)); 115 MapEventToTabStrip(event, mapped_data));
115 return tabstrip()->OnPerformDrop(*mapped_event); 116 return tabstrip()->OnPerformDrop(*mapped_event);
116 } 117 }
117 118
118 const char* BrowserRootView::GetClassName() const { 119 const char* BrowserRootView::GetClassName() const {
119 return kViewClassName; 120 return kViewClassName;
120 } 121 }
121 122
123 void BrowserRootView::DispatchGestureEvent(ui::GestureEvent* event) {
124 if (event->type() == ui::ET_GESTURE_TAP &&
125 event->location().y() <= 0 &&
126 event->location().x() <= browser_view_->GetBounds().width()) {
127 TouchUMA::RecordGestureAction(TouchUMA::GESTURE_ROOTVIEWTOP_TAP);
128 }
129
130 RootView::DispatchGestureEvent(event);
131 }
132
122 bool BrowserRootView::ShouldForwardToTabStrip( 133 bool BrowserRootView::ShouldForwardToTabStrip(
123 const ui::DropTargetEvent& event) { 134 const ui::DropTargetEvent& event) {
124 if (!tabstrip()->visible()) 135 if (!tabstrip()->visible())
125 return false; 136 return false;
126 137
127 // Allow the drop as long as the mouse is over the tabstrip or vertically 138 // Allow the drop as long as the mouse is over the tabstrip or vertically
128 // before it. 139 // before it.
129 gfx::Point tab_loc_in_host; 140 gfx::Point tab_loc_in_host;
130 ConvertPointToTarget(tabstrip(), this, &tab_loc_in_host); 141 ConvertPointToTarget(tabstrip(), this, &tab_loc_in_host);
131 return event.y() < tab_loc_in_host.y() + tabstrip()->height(); 142 return event.y() < tab_loc_in_host.y() + tabstrip()->height();
(...skipping 26 matching lines...) Expand all
158 AutocompleteClassifierFactory::GetForProfile( 169 AutocompleteClassifierFactory::GetForProfile(
159 browser_view_->browser()->profile())->Classify(text, false, false, &match, 170 browser_view_->browser()->profile())->Classify(text, false, false, &match,
160 NULL); 171 NULL);
161 if (!match.destination_url.is_valid()) 172 if (!match.destination_url.is_valid())
162 return false; 173 return false;
163 174
164 if (url) 175 if (url)
165 *url = match.destination_url; 176 *url = match.destination_url;
166 return true; 177 return true;
167 } 178 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698