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

Side by Side Diff: chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc

Issue 74133003: linux-aura: Restore middle-click on new-tab button behaviour. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-nit Created 7 years, 1 month 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/tabs/browser_tab_strip_controller.h" 5 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
11 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
12 #include "chrome/browser/autocomplete/autocomplete_match.h"
10 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/extensions/tab_helper.h" 15 #include "chrome/browser/extensions/tab_helper.h"
13 #include "chrome/browser/favicon/favicon_tab_helper.h" 16 #include "chrome/browser/favicon/favicon_tab_helper.h"
14 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/search/search.h" 18 #include "chrome/browser/search/search.h"
16 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_tabstrip.h" 20 #include "chrome/browser/ui/browser_tabstrip.h"
18 #include "chrome/browser/ui/tabs/tab_menu_model.h" 21 #include "chrome/browser/ui/tabs/tab_menu_model.h"
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" 22 #include "chrome/browser/ui/tabs/tab_strip_model.h"
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 chrome::Navigate(&params); 346 chrome::Navigate(&params);
344 } 347 }
345 348
346 bool BrowserTabStripController::IsCompatibleWith(TabStrip* other) const { 349 bool BrowserTabStripController::IsCompatibleWith(TabStrip* other) const {
347 Profile* other_profile = 350 Profile* other_profile =
348 static_cast<BrowserTabStripController*>(other->controller())->profile(); 351 static_cast<BrowserTabStripController*>(other->controller())->profile();
349 return other_profile == profile(); 352 return other_profile == profile();
350 } 353 }
351 354
352 void BrowserTabStripController::CreateNewTab() { 355 void BrowserTabStripController::CreateNewTab() {
353 model_->delegate()->AddBlankTabAt(-1, true); 356 model_->delegate()->AddURLTabAt(GURL(), -1, true);
357 }
358
359 void BrowserTabStripController::CreateNewTabWithLocation(
360 const base::string16& location) {
361 // Use autocomplete to clean up the text, going so far as to turn it into
362 // a search query if necessary.
363 AutocompleteMatch match;
364 AutocompleteClassifierFactory::GetForProfile(profile())->Classify(
365 location, false, false, &match, NULL);
366 if (match.destination_url.is_valid())
367 model_->delegate()->AddURLTabAt(match.destination_url, -1, true);
354 } 368 }
355 369
356 bool BrowserTabStripController::IsIncognito() { 370 bool BrowserTabStripController::IsIncognito() {
357 return browser_->profile()->IsOffTheRecord(); 371 return browser_->profile()->IsOffTheRecord();
358 } 372 }
359 373
360 void BrowserTabStripController::LayoutTypeMaybeChanged() { 374 void BrowserTabStripController::LayoutTypeMaybeChanged() {
361 bool adjust_layout = false; 375 bool adjust_layout = false;
362 TabStripLayoutType layout_type = 376 TabStripLayoutType layout_type =
363 DetermineTabStripLayout(g_browser_process->local_state(), 377 DetermineTabStripLayout(g_browser_process->local_state(),
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 tabstrip_->AddTabAt(index, data, is_active); 539 tabstrip_->AddTabAt(index, data, is_active);
526 } 540 }
527 541
528 void BrowserTabStripController::UpdateLayoutType() { 542 void BrowserTabStripController::UpdateLayoutType() {
529 bool adjust_layout = false; 543 bool adjust_layout = false;
530 TabStripLayoutType layout_type = 544 TabStripLayoutType layout_type =
531 DetermineTabStripLayout(g_browser_process->local_state(), 545 DetermineTabStripLayout(g_browser_process->local_state(),
532 browser_->host_desktop_type(), &adjust_layout); 546 browser_->host_desktop_type(), &adjust_layout);
533 tabstrip_->SetLayoutType(layout_type, adjust_layout); 547 tabstrip_->SetLayoutType(layout_type, adjust_layout);
534 } 548 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698