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

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

Issue 1084903002: Fix horizontal scroll tab-switching behavior on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/autocomplete/autocomplete_classifier.h" 7 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
8 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 8 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
9 #include "chrome/browser/defaults.h" 9 #include "chrome/browser/defaults.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 if (browser_defaults::kScrollEventChangesTab) { 124 if (browser_defaults::kScrollEventChangesTab) {
125 // Switch to the left/right tab if the wheel-scroll happens over the 125 // Switch to the left/right tab if the wheel-scroll happens over the
126 // tabstrip, or the empty space beside the tabstrip. 126 // tabstrip, or the empty space beside the tabstrip.
127 views::View* hit_view = GetEventHandlerForPoint(event.location()); 127 views::View* hit_view = GetEventHandlerForPoint(event.location());
128 int hittest = 128 int hittest =
129 GetWidget()->non_client_view()->NonClientHitTest(event.location()); 129 GetWidget()->non_client_view()->NonClientHitTest(event.location());
130 if (tabstrip()->Contains(hit_view) || 130 if (tabstrip()->Contains(hit_view) ||
131 hittest == HTCAPTION || 131 hittest == HTCAPTION ||
132 hittest == HTTOP) { 132 hittest == HTTOP) {
133 int scroll_offset = abs(event.y_offset()) > abs(event.x_offset()) ? 133 int scroll_offset = abs(event.y_offset()) > abs(event.x_offset()) ?
134 event.y_offset() : -event.x_offset(); 134 event.y_offset() : event.x_offset();
135 Browser* browser = browser_view_->browser(); 135 Browser* browser = browser_view_->browser();
136 TabStripModel* model = browser->tab_strip_model(); 136 TabStripModel* model = browser->tab_strip_model();
137 // Switch to the next tab only if not at the end of the tab-strip. 137 // Switch to the next tab only if not at the end of the tab-strip.
138 if (scroll_offset < 0 && model->active_index() + 1 < model->count()) { 138 if (scroll_offset < 0 && model->active_index() + 1 < model->count()) {
139 chrome::SelectNextTab(browser); 139 chrome::SelectNextTab(browser);
140 return true; 140 return true;
141 } 141 }
142 142
143 // Switch to the previous tab only if not at the beginning of the 143 // Switch to the previous tab only if not at the beginning of the
144 // tab-strip. 144 // tab-strip.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 browser_view_->browser()->profile())->Classify( 204 browser_view_->browser()->profile())->Classify(
205 text, false, false, metrics::OmniboxEventProto::INVALID_SPEC, &match, 205 text, false, false, metrics::OmniboxEventProto::INVALID_SPEC, &match,
206 nullptr); 206 nullptr);
207 if (!match.destination_url.is_valid()) 207 if (!match.destination_url.is_valid())
208 return false; 208 return false;
209 209
210 if (url) 210 if (url)
211 *url = match.destination_url; 211 *url = match.destination_url;
212 return true; 212 return true;
213 } 213 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698