Chromium Code Reviews| 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/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/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
| 18 #include "grit/chromium_strings.h" | 18 #include "grit/chromium_strings.h" |
| 19 #include "ui/base/accessibility/accessible_view_state.h" | 19 #include "ui/base/accessibility/accessible_view_state.h" |
| 20 #include "ui/base/dragdrop/drag_drop_types.h" | 20 #include "ui/base/dragdrop/drag_drop_types.h" |
| 21 #include "ui/base/dragdrop/os_exchange_data.h" | 21 #include "ui/base/dragdrop/os_exchange_data.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 23 | 23 |
| 24 #if defined(USE_ASH) | |
| 25 #include "ash/touch/touch_uma.h" | |
| 26 | |
| 27 using ash::internal::TouchUMA; | |
| 28 #endif | |
| 29 | |
| 24 // static | 30 // static |
| 25 const char BrowserRootView::kViewClassName[] = | 31 const char BrowserRootView::kViewClassName[] = |
| 26 "browser/ui/views/frame/BrowserRootView"; | 32 "browser/ui/views/frame/BrowserRootView"; |
| 27 | 33 |
| 28 BrowserRootView::BrowserRootView(BrowserView* browser_view, | 34 BrowserRootView::BrowserRootView(BrowserView* browser_view, |
| 29 views::Widget* widget) | 35 views::Widget* widget) |
| 30 : views::internal::RootView(widget), | 36 : views::internal::RootView(widget), |
| 31 browser_view_(browser_view), | 37 browser_view_(browser_view), |
| 32 forwarding_to_tab_strip_(false) { } | 38 forwarding_to_tab_strip_(false) { } |
| 33 | 39 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 forwarding_to_tab_strip_ = false; | 118 forwarding_to_tab_strip_ = false; |
| 113 scoped_ptr<ui::DropTargetEvent> mapped_event( | 119 scoped_ptr<ui::DropTargetEvent> mapped_event( |
| 114 MapEventToTabStrip(event, mapped_data)); | 120 MapEventToTabStrip(event, mapped_data)); |
| 115 return tabstrip()->OnPerformDrop(*mapped_event); | 121 return tabstrip()->OnPerformDrop(*mapped_event); |
| 116 } | 122 } |
| 117 | 123 |
| 118 const char* BrowserRootView::GetClassName() const { | 124 const char* BrowserRootView::GetClassName() const { |
| 119 return kViewClassName; | 125 return kViewClassName; |
| 120 } | 126 } |
| 121 | 127 |
| 128 #if defined(USE_ASH) | |
| 129 void BrowserRootView::DispatchGestureEvent(ui::GestureEvent* event) { | |
| 130 if (event->type() == ui::ET_GESTURE_TAP && | |
| 131 event->location().y() <= 0 && | |
| 132 event->location().x() <= browser_view_->GetBounds().width()) | |
| 133 TouchUMA::GetInstance()->RecordGestureAction( | |
|
sky
2013/06/26 23:42:55
use {} since condition is multi-line.
tdanderson
2013/06/27 22:39:33
Done.
| |
| 134 TouchUMA::GESTURE_ROOTVIEWTOP_TAP); | |
| 135 | |
| 136 RootView::DispatchGestureEvent(event); | |
| 137 } | |
| 138 #endif | |
| 139 | |
| 122 bool BrowserRootView::ShouldForwardToTabStrip( | 140 bool BrowserRootView::ShouldForwardToTabStrip( |
| 123 const ui::DropTargetEvent& event) { | 141 const ui::DropTargetEvent& event) { |
| 124 if (!tabstrip()->visible()) | 142 if (!tabstrip()->visible()) |
| 125 return false; | 143 return false; |
| 126 | 144 |
| 127 // Allow the drop as long as the mouse is over the tabstrip or vertically | 145 // Allow the drop as long as the mouse is over the tabstrip or vertically |
| 128 // before it. | 146 // before it. |
| 129 gfx::Point tab_loc_in_host; | 147 gfx::Point tab_loc_in_host; |
| 130 ConvertPointToTarget(tabstrip(), this, &tab_loc_in_host); | 148 ConvertPointToTarget(tabstrip(), this, &tab_loc_in_host); |
| 131 return event.y() < tab_loc_in_host.y() + tabstrip()->height(); | 149 return event.y() < tab_loc_in_host.y() + tabstrip()->height(); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 158 AutocompleteClassifierFactory::GetForProfile( | 176 AutocompleteClassifierFactory::GetForProfile( |
| 159 browser_view_->browser()->profile())->Classify(text, false, false, &match, | 177 browser_view_->browser()->profile())->Classify(text, false, false, &match, |
| 160 NULL); | 178 NULL); |
| 161 if (!match.destination_url.is_valid()) | 179 if (!match.destination_url.is_valid()) |
| 162 return false; | 180 return false; |
| 163 | 181 |
| 164 if (url) | 182 if (url) |
| 165 *url = match.destination_url; | 183 *url = match.destination_url; |
| 166 return true; | 184 return true; |
| 167 } | 185 } |
| OLD | NEW |