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

Side by Side Diff: chrome/browser/android/locale/special_locale_handler.cc

Issue 2487633003: Change behaivor to decide whether a search engine should be shown in the default list (Closed)
Patch Set: Update based on Peter and Nicolas's comments. Created 4 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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/android/locale/special_locale_handler.h" 5 #include "chrome/browser/android/locale/special_locale_handler.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/jni_weak_ref.h" 9 #include "base/android/jni_weak_ref.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 DCHECK(locale_.length() == 2); 62 DCHECK(locale_.length() == 2);
63 63
64 std::vector<std::unique_ptr<TemplateURLData>> prepopulated_list = 64 std::vector<std::unique_ptr<TemplateURLData>> prepopulated_list =
65 TemplateURLPrepopulateData::GetLocalPrepopulatedEngines( 65 TemplateURLPrepopulateData::GetLocalPrepopulatedEngines(
66 locale_, GetOriginalProfile()->GetPrefs()); 66 locale_, GetOriginalProfile()->GetPrefs());
67 67
68 if (prepopulated_list.empty()) 68 if (prepopulated_list.empty())
69 return false; 69 return false;
70 70
71 for (const auto& data_url : prepopulated_list) { 71 for (const auto& data_url : prepopulated_list) {
72 data_url.get()->show_in_default_list = false;
73 data_url.get()->safe_for_autoreplace = true; 72 data_url.get()->safe_for_autoreplace = true;
74 std::unique_ptr<TemplateURL> turl( 73 std::unique_ptr<TemplateURL> turl(
75 new TemplateURL(*data_url, TemplateURL::LOCAL)); 74 new TemplateURL(*data_url, TemplateURL::LOCAL));
76 TemplateURL* added_turl = template_url_service_->Add(std::move(turl)); 75 TemplateURL* added_turl = template_url_service_->Add(std::move(turl));
77 if (added_turl) { 76 if (added_turl) {
78 prepopulate_ids_.push_back(added_turl->prepopulate_id()); 77 prepopulate_ids_.push_back(added_turl->prepopulate_id());
79 } 78 }
80 } 79 }
81 return true; 80 return true;
82 } 81 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 template_url_service_->SetUserSelectedDefaultSearchProvider(turl); 129 template_url_service_->SetUserSelectedDefaultSearchProvider(turl);
131 } 130 }
132 } 131 }
133 132
134 SpecialLocaleHandler::~SpecialLocaleHandler() {} 133 SpecialLocaleHandler::~SpecialLocaleHandler() {}
135 134
136 // static 135 // static
137 bool RegisterSpecialLocaleHandler(JNIEnv* env) { 136 bool RegisterSpecialLocaleHandler(JNIEnv* env) {
138 return RegisterNativesImpl(env); 137 return RegisterNativesImpl(env);
139 } 138 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698