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

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs.cc

Issue 10698068: chrome: Put browser_navigator.h into chrome namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: already in chrome namespace Created 8 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/extensions/api/tabs/tabs.h" 5 #include "chrome/browser/extensions/api/tabs/tabs.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 // If incognito argument is not specified explicitly, we default to 365 // If incognito argument is not specified explicitly, we default to
366 // incognito when forced so by policy. 366 // incognito when forced so by policy.
367 incognito = true; 367 incognito = true;
368 } 368 }
369 369
370 // Remove all URLs that are not allowed in an incognito session. Note that a 370 // Remove all URLs that are not allowed in an incognito session. Note that a
371 // ChromeOS guest session is not considered incognito in this case. 371 // ChromeOS guest session is not considered incognito in this case.
372 if (incognito && !Profile::IsGuestSession()) { 372 if (incognito && !Profile::IsGuestSession()) {
373 std::string first_url_erased; 373 std::string first_url_erased;
374 for (size_t i = 0; i < urls->size();) { 374 for (size_t i = 0; i < urls->size();) {
375 if (browser::IsURLAllowedInIncognito((*urls)[i])) { 375 if (chrome::IsURLAllowedInIncognito((*urls)[i])) {
376 i++; 376 i++;
377 } else { 377 } else {
378 if (first_url_erased.empty()) 378 if (first_url_erased.empty())
379 first_url_erased = (*urls)[i].spec(); 379 first_url_erased = (*urls)[i].spec();
380 urls->erase(urls->begin() + i); 380 urls->erase(urls->begin() + i);
381 } 381 }
382 } 382 }
383 if (urls->empty() && !first_url_erased.empty()) { 383 if (urls->empty() && !first_url_erased.empty()) {
384 error_ = ExtensionErrorUtils::FormatErrorMessage( 384 error_ = ExtensionErrorUtils::FormatErrorMessage(
385 keys::kURLsNotAllowedInIncognitoError, first_url_erased); 385 keys::kURLsNotAllowedInIncognitoError, first_url_erased);
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 1070
1071 TabStripModel* tab_strip = browser->tab_strip_model(); 1071 TabStripModel* tab_strip = browser->tab_strip_model();
1072 1072
1073 index = std::min(std::max(index, -1), tab_strip->count()); 1073 index = std::min(std::max(index, -1), tab_strip->count());
1074 1074
1075 int add_types = active ? TabStripModel::ADD_ACTIVE : 1075 int add_types = active ? TabStripModel::ADD_ACTIVE :
1076 TabStripModel::ADD_NONE; 1076 TabStripModel::ADD_NONE;
1077 add_types |= TabStripModel::ADD_FORCE_INDEX; 1077 add_types |= TabStripModel::ADD_FORCE_INDEX;
1078 if (pinned) 1078 if (pinned)
1079 add_types |= TabStripModel::ADD_PINNED; 1079 add_types |= TabStripModel::ADD_PINNED;
1080 browser::NavigateParams params(browser, url, content::PAGE_TRANSITION_LINK); 1080 chrome::NavigateParams params(browser, url, content::PAGE_TRANSITION_LINK);
1081 params.disposition = active ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB; 1081 params.disposition = active ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB;
1082 params.tabstrip_index = index; 1082 params.tabstrip_index = index;
1083 params.tabstrip_add_types = add_types; 1083 params.tabstrip_add_types = add_types;
1084 browser::Navigate(&params); 1084 chrome::Navigate(&params);
1085 1085
1086 // The tab may have been created in a different window, so make sure we look 1086 // The tab may have been created in a different window, so make sure we look
1087 // at the right tab strip. 1087 // at the right tab strip.
1088 tab_strip = params.browser->tab_strip_model(); 1088 tab_strip = params.browser->tab_strip_model();
1089 int new_index = tab_strip->GetIndexOfTabContents(params.target_contents); 1089 int new_index = tab_strip->GetIndexOfTabContents(params.target_contents);
1090 if (opener) 1090 if (opener)
1091 tab_strip->SetOpenerOfTabContentsAt(new_index, opener); 1091 tab_strip->SetOpenerOfTabContentsAt(new_index, opener);
1092 1092
1093 if (active) 1093 if (active)
1094 params.target_contents->web_contents()->GetView()->SetInitialFocus(); 1094 params.target_contents->web_contents()->GetView()->SetInitialFocus();
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 // called for every API call the extension made. 1826 // called for every API call the extension made.
1827 GotLanguage(language); 1827 GotLanguage(language);
1828 } 1828 }
1829 1829
1830 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { 1830 void DetectTabLanguageFunction::GotLanguage(const std::string& language) {
1831 result_.reset(Value::CreateStringValue(language.c_str())); 1831 result_.reset(Value::CreateStringValue(language.c_str()));
1832 SendResponse(true); 1832 SendResponse(true);
1833 1833
1834 Release(); // Balanced in Run() 1834 Release(); // Balanced in Run()
1835 } 1835 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698