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

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator.cc

Issue 320253004: Componentize URLFixerUpper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win64 fix Created 6 years, 6 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/ui/startup/startup_browser_creator.h" 5 #include "chrome/browser/ui/startup/startup_browser_creator.h"
6 6
7 #include <algorithm> // For max(). 7 #include <algorithm> // For max().
8 #include <set> 8 #include <set>
9 9
10 #include "apps/app_load_service.h" 10 #include "apps/app_load_service.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "chrome/browser/ui/browser.h" 47 #include "chrome/browser/ui/browser.h"
48 #include "chrome/browser/ui/browser_dialogs.h" 48 #include "chrome/browser/ui/browser_dialogs.h"
49 #include "chrome/browser/ui/browser_finder.h" 49 #include "chrome/browser/ui/browser_finder.h"
50 #include "chrome/browser/ui/browser_window.h" 50 #include "chrome/browser/ui/browser_window.h"
51 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" 51 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
52 #include "chrome/common/chrome_constants.h" 52 #include "chrome/common/chrome_constants.h"
53 #include "chrome/common/chrome_paths.h" 53 #include "chrome/common/chrome_paths.h"
54 #include "chrome/common/chrome_result_codes.h" 54 #include "chrome/common/chrome_result_codes.h"
55 #include "chrome/common/chrome_switches.h" 55 #include "chrome/common/chrome_switches.h"
56 #include "chrome/common/chrome_version_info.h" 56 #include "chrome/common/chrome_version_info.h"
57 #include "chrome/common/net/url_fixer_upper.h"
58 #include "chrome/common/pref_names.h" 57 #include "chrome/common/pref_names.h"
59 #include "chrome/common/url_constants.h" 58 #include "chrome/common/url_constants.h"
60 #include "chrome/installer/util/browser_distribution.h" 59 #include "chrome/installer/util/browser_distribution.h"
61 #include "components/signin/core/common/profile_management_switches.h" 60 #include "components/signin/core/common/profile_management_switches.h"
61 #include "components/url_fixer/url_fixer.h"
62 #include "content/public/browser/browser_thread.h" 62 #include "content/public/browser/browser_thread.h"
63 #include "content/public/browser/child_process_security_policy.h" 63 #include "content/public/browser/child_process_security_policy.h"
64 #include "content/public/browser/navigation_controller.h" 64 #include "content/public/browser/navigation_controller.h"
65 #include "grit/locale_settings.h" 65 #include "grit/locale_settings.h"
66 #include "net/base/net_util.h" 66 #include "net/base/net_util.h"
67 #include "ui/base/l10n/l10n_util.h" 67 #include "ui/base/l10n/l10n_util.h"
68 #include "ui/base/resource/resource_bundle.h" 68 #include "ui/base/resource/resource_bundle.h"
69 69
70 #if defined(USE_ASH) 70 #if defined(USE_ASH)
71 #include "ash/shell.h" 71 #include "ash/shell.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 // This will create a file URL or a regular URL. 424 // This will create a file URL or a regular URL.
425 // This call can (in rare circumstances) block the UI thread. 425 // This call can (in rare circumstances) block the UI thread.
426 // Allow it until this bug is fixed. 426 // Allow it until this bug is fixed.
427 // http://code.google.com/p/chromium/issues/detail?id=60641 427 // http://code.google.com/p/chromium/issues/detail?id=60641
428 GURL url = GURL(param.MaybeAsASCII()); 428 GURL url = GURL(param.MaybeAsASCII());
429 // http://crbug.com/371030: Only use URLFixerUpper if we don't have a valid 429 // http://crbug.com/371030: Only use URLFixerUpper if we don't have a valid
430 // URL, otherwise we will look in the current directory for a file named 430 // URL, otherwise we will look in the current directory for a file named
431 // 'about' if the browser was started with a about:foo argument. 431 // 'about' if the browser was started with a about:foo argument.
432 if (!url.is_valid()) { 432 if (!url.is_valid()) {
433 base::ThreadRestrictions::ScopedAllowIO allow_io; 433 base::ThreadRestrictions::ScopedAllowIO allow_io;
434 url = URLFixerUpper::FixupRelativeFile(cur_dir, param); 434 url = url_fixer::FixupRelativeFile(cur_dir, param);
435 } 435 }
436 // Exclude dangerous schemes. 436 // Exclude dangerous schemes.
437 if (url.is_valid()) { 437 if (url.is_valid()) {
438 ChildProcessSecurityPolicy* policy = 438 ChildProcessSecurityPolicy* policy =
439 ChildProcessSecurityPolicy::GetInstance(); 439 ChildProcessSecurityPolicy::GetInstance();
440 if (policy->IsWebSafeScheme(url.scheme()) || 440 if (policy->IsWebSafeScheme(url.scheme()) ||
441 url.SchemeIs(url::kFileScheme) || 441 url.SchemeIs(url::kFileScheme) ||
442 #if defined(OS_CHROMEOS) 442 #if defined(OS_CHROMEOS)
443 // In ChromeOS, allow a settings page to be specified on the 443 // In ChromeOS, allow a settings page to be specified on the
444 // command line. See ExistingUserController::OnLoginSuccess. 444 // command line. See ExistingUserController::OnLoginSuccess.
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 } 728 }
729 729
730 if (command_line.HasSwitch(switches::kProfileDirectory)) { 730 if (command_line.HasSwitch(switches::kProfileDirectory)) {
731 return user_data_dir.Append( 731 return user_data_dir.Append(
732 command_line.GetSwitchValuePath(switches::kProfileDirectory)); 732 command_line.GetSwitchValuePath(switches::kProfileDirectory));
733 } 733 }
734 734
735 return g_browser_process->profile_manager()->GetLastUsedProfileDir( 735 return g_browser_process->profile_manager()->GetLastUsedProfileDir(
736 user_data_dir); 736 user_data_dir);
737 } 737 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698