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

Side by Side Diff: chrome/browser/importer/firefox_importer_utils.cc

Issue 4281: Fixes bug in importer where we could set the default search provider... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/importer/importer.cc » ('j') | chrome/browser/importer/importer.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/importer/firefox_importer_utils.h" 5 #include "chrome/browser/importer/firefox_importer_utils.h"
6 6
7 #include <shlobj.h> 7 #include <shlobj.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 const std::wstring& profile_path) { 321 const std::wstring& profile_path) {
322 // The default search engine is contained in the file prefs.js found in the 322 // The default search engine is contained in the file prefs.js found in the
323 // profile directory. 323 // profile directory.
324 // It is the "browser.search.selectedEngine" property. 324 // It is the "browser.search.selectedEngine" property.
325 if (search_engines.empty()) 325 if (search_engines.empty())
326 return -1; 326 return -1;
327 327
328 std::wstring default_se_name = UTF8ToWide( 328 std::wstring default_se_name = UTF8ToWide(
329 ReadPrefsJsValue(profile_path, "browser.search.selectedEngine")); 329 ReadPrefsJsValue(profile_path, "browser.search.selectedEngine"));
330 330
331 if (default_se_name.empty()) {
332 // browser.search.selectedEngine does not exist if the user has not changed
333 // from the default (or has selected the default).
334 // TODO: should fallback to 'browser.search.defaultengine' if selectedEngine
335 // is empty.
336 return -1;
337 }
338
331 int default_se_index = -1; 339 int default_se_index = -1;
332 for (std::vector<TemplateURL*>::const_iterator iter = search_engines.begin(); 340 for (std::vector<TemplateURL*>::const_iterator iter = search_engines.begin();
333 iter != search_engines.end(); ++iter) { 341 iter != search_engines.end(); ++iter) {
334 if (default_se_name == (*iter)->short_name()) { 342 if (default_se_name == (*iter)->short_name()) {
335 default_se_index = static_cast<int>(iter - search_engines.begin()); 343 default_se_index = static_cast<int>(iter - search_engines.begin());
336 break; 344 break;
337 } 345 }
338 } 346 }
339 if (default_se_index == -1) { 347 if (default_se_index == -1) {
340 NOTREACHED() << 348 NOTREACHED() <<
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 // Version 3 has an extra line for further use. 726 // Version 3 has an extra line for further use.
719 if (version == 3) { 727 if (version == 3) {
720 ++begin; 728 ++begin;
721 } 729 }
722 730
723 forms->push_back(form); 731 forms->push_back(form);
724 } 732 }
725 } 733 }
726 } 734 }
727 735
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/importer/importer.cc » ('j') | chrome/browser/importer/importer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698