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

Side by Side Diff: chrome/browser/extensions/extension_tabs_module.cc

Issue 8588013: Fix crash in SyncSetupWizard::IsVisible() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add browser test Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extension_tabs_module.h" 5 #include "chrome/browser/extensions/extension_tabs_module.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 error_ = keys::kIncognitoModeIsForced; 270 error_ = keys::kIncognitoModeIsForced;
271 *is_error = true; 271 *is_error = true;
272 return false; 272 return false;
273 } 273 }
274 } else if (incognito_availability == IncognitoModePrefs::FORCED) { 274 } else if (incognito_availability == IncognitoModePrefs::FORCED) {
275 // If incognito argument is not specified explicitly, we default to 275 // If incognito argument is not specified explicitly, we default to
276 // incognito when forced so by policy. 276 // incognito when forced so by policy.
277 incognito = true; 277 incognito = true;
278 } 278 }
279 279
280 // If we are opening an incognito window. 280 // Remove all URLs that are not allowed in an incognito session. Note that a
281 if (incognito) { 281 // ChromeOS guest session is not considered incognito in this case.
282 if (incognito && !Profile::IsGuestSession()) {
282 std::string first_url_erased; 283 std::string first_url_erased;
283 // Guest session is an exception as it always opens in incognito mode.
284 for (size_t i = 0; i < urls->size();) { 284 for (size_t i = 0; i < urls->size();) {
285 if (browser::IsURLAllowedInIncognito((*urls)[i]) && 285 if (browser::IsURLAllowedInIncognito((*urls)[i])) {
286 !Profile::IsGuestSession()) { 286 i++;
287 } else {
287 if (first_url_erased.empty()) 288 if (first_url_erased.empty())
288 first_url_erased = (*urls)[i].spec(); 289 first_url_erased = (*urls)[i].spec();
289 urls->erase(urls->begin() + i); 290 urls->erase(urls->begin() + i);
290 } else {
291 i++;
292 } 291 }
293 } 292 }
294 if (urls->empty() && !first_url_erased.empty()) { 293 if (urls->empty() && !first_url_erased.empty()) {
295 error_ = ExtensionErrorUtils::FormatErrorMessage( 294 error_ = ExtensionErrorUtils::FormatErrorMessage(
296 keys::kURLsNotAllowedInIncognitoError, first_url_erased); 295 keys::kURLsNotAllowedInIncognitoError, first_url_erased);
297 *is_error = true; 296 *is_error = true;
298 return false; 297 return false;
299 } 298 }
300 } 299 }
301 return incognito; 300 return incognito;
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 // called for every API call the extension made. 1568 // called for every API call the extension made.
1570 GotLanguage(language); 1569 GotLanguage(language);
1571 } 1570 }
1572 1571
1573 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { 1572 void DetectTabLanguageFunction::GotLanguage(const std::string& language) {
1574 result_.reset(Value::CreateStringValue(language.c_str())); 1573 result_.reset(Value::CreateStringValue(language.c_str()));
1575 SendResponse(true); 1574 SendResponse(true);
1576 1575
1577 Release(); // Balanced in Run() 1576 Release(); // Balanced in Run()
1578 } 1577 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/browser_navigator.h » ('j') | chrome/browser/ui/browser_navigator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698