| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |