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

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

Issue 1477783004: Add a preference to control Windows desktop search redirection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile error. Created 5 years 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
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) 85 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX)
86 #include "ui/events/devices/x11/touch_factory_x11.h" 86 #include "ui/events/devices/x11/touch_factory_x11.h"
87 #endif 87 #endif
88 88
89 #if defined(OS_MACOSX) 89 #if defined(OS_MACOSX)
90 #include "chrome/browser/web_applications/web_app_mac.h" 90 #include "chrome/browser/web_applications/web_app_mac.h"
91 #endif 91 #endif
92 92
93 #if defined(OS_WIN) 93 #if defined(OS_WIN)
94 #include "chrome/browser/metrics/jumplist_metrics_win.h" 94 #include "chrome/browser/metrics/jumplist_metrics_win.h"
95 #include "components/search_engines/detect_desktop_search_win.h" 95 #include "components/search_engines/desktop_search_win.h"
96 #include "components/search_engines/search_engines_switches.h"
97 #endif 96 #endif
98 97
99 #if defined(ENABLE_PRINT_PREVIEW) 98 #if defined(ENABLE_PRINT_PREVIEW)
100 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" 99 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
101 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" 100 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h"
102 #include "chrome/browser/printing/print_dialog_cloud.h" 101 #include "chrome/browser/printing/print_dialog_cloud.h"
103 #endif 102 #endif
104 103
105 using content::BrowserThread; 104 using content::BrowserThread;
106 using content::ChildProcessSecurityPolicy; 105 using content::ChildProcessSecurityPolicy;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 545
547 // Otherwise, fall through to treating it as a URL. 546 // Otherwise, fall through to treating it as a URL.
548 547
549 // This will create a file URL or a regular URL. 548 // This will create a file URL or a regular URL.
550 // This call can (in rare circumstances) block the UI thread. 549 // This call can (in rare circumstances) block the UI thread.
551 // Allow it until this bug is fixed. 550 // Allow it until this bug is fixed.
552 // http://code.google.com/p/chromium/issues/detail?id=60641 551 // http://code.google.com/p/chromium/issues/detail?id=60641
553 GURL url = GURL(param.MaybeAsASCII()); 552 GURL url = GURL(param.MaybeAsASCII());
554 553
555 #if defined(OS_WIN) 554 #if defined(OS_WIN)
556 if (command_line.HasSwitch( 555 if (ShouldRedirectWindowsDesktopSearchToDefaultSearchEngine(
557 switches::kUseDefaultSearchProviderForDesktopSearch)) { 556 profile->GetPrefs())) {
558 TemplateURLService* template_url_service = 557 TemplateURLService* template_url_service =
559 TemplateURLServiceFactory::GetForProfile(profile); 558 TemplateURLServiceFactory::GetForProfile(profile);
560 DCHECK(template_url_service); 559 DCHECK(template_url_service);
561 base::string16 search_terms; 560 base::string16 search_terms;
562 if (DetectWindowsDesktopSearch( 561 if (DetectWindowsDesktopSearch(
563 url, template_url_service->search_terms_data(), &search_terms)) { 562 url, template_url_service->search_terms_data(), &search_terms)) {
564 GURL search_url(GetDefaultSearchURLForSearchTerms(template_url_service, 563 const GURL search_url(GetDefaultSearchURLForSearchTerms(
565 search_terms)); 564 template_url_service, search_terms));
566 if (search_url.is_valid()) { 565 if (search_url.is_valid()) {
567 urls.push_back(search_url); 566 urls.push_back(search_url);
568 continue; 567 continue;
569 } 568 }
570 } 569 }
571 } 570 }
572 #endif // defined(OS_WIN) 571 #endif // defined(OS_WIN)
573 572
574 // http://crbug.com/371030: Only use URLFixerUpper if we don't have a valid 573 // http://crbug.com/371030: Only use URLFixerUpper if we don't have a valid
575 // URL, otherwise we will look in the current directory for a file named 574 // URL, otherwise we will look in the current directory for a file named
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 // If we are showing the app list then chrome isn't shown so load the app 928 // If we are showing the app list then chrome isn't shown so load the app
930 // list's profile rather than chrome's. 929 // list's profile rather than chrome's.
931 if (command_line.HasSwitch(switches::kShowAppList)) { 930 if (command_line.HasSwitch(switches::kShowAppList)) {
932 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> 931 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)->
933 GetProfilePath(user_data_dir); 932 GetProfilePath(user_data_dir);
934 } 933 }
935 934
936 return g_browser_process->profile_manager()->GetLastUsedProfileDir( 935 return g_browser_process->profile_manager()->GetLastUsedProfileDir(
937 user_data_dir); 936 user_data_dir);
938 } 937 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator.h ('k') | chrome/browser/ui/startup/startup_browser_creator_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698