OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/search_engines/default_search_manager.h" | 5 #include "components/search_engines/default_search_manager.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <algorithm> | 10 #include <algorithm> |
8 #include <utility> | 11 #include <utility> |
9 | 12 |
10 #include "base/bind.h" | 13 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
12 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
13 #include "base/i18n/case_conversion.h" | 16 #include "base/i18n/case_conversion.h" |
14 #include "base/logging.h" | 17 #include "base/logging.h" |
15 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
16 #include "base/prefs/pref_value_map.h" | 19 #include "base/prefs/pref_value_map.h" |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 &prefs_default_search_->image_url_post_params); | 350 &prefs_default_search_->image_url_post_params); |
348 | 351 |
349 url_dict->GetBoolean(kSafeForAutoReplace, | 352 url_dict->GetBoolean(kSafeForAutoReplace, |
350 &prefs_default_search_->safe_for_autoreplace); | 353 &prefs_default_search_->safe_for_autoreplace); |
351 | 354 |
352 std::string date_created_str; | 355 std::string date_created_str; |
353 std::string last_modified_str; | 356 std::string last_modified_str; |
354 url_dict->GetString(kDateCreated, &date_created_str); | 357 url_dict->GetString(kDateCreated, &date_created_str); |
355 url_dict->GetString(kLastModified, &last_modified_str); | 358 url_dict->GetString(kLastModified, &last_modified_str); |
356 | 359 |
357 int64 date_created = 0; | 360 int64_t date_created = 0; |
358 if (base::StringToInt64(date_created_str, &date_created)) { | 361 if (base::StringToInt64(date_created_str, &date_created)) { |
359 prefs_default_search_->date_created = | 362 prefs_default_search_->date_created = |
360 base::Time::FromInternalValue(date_created); | 363 base::Time::FromInternalValue(date_created); |
361 } | 364 } |
362 | 365 |
363 int64 last_modified = 0; | 366 int64_t last_modified = 0; |
364 if (base::StringToInt64(date_created_str, &last_modified)) { | 367 if (base::StringToInt64(date_created_str, &last_modified)) { |
365 prefs_default_search_->last_modified = | 368 prefs_default_search_->last_modified = |
366 base::Time::FromInternalValue(last_modified); | 369 base::Time::FromInternalValue(last_modified); |
367 } | 370 } |
368 | 371 |
369 url_dict->GetInteger(kUsageCount, &prefs_default_search_->usage_count); | 372 url_dict->GetInteger(kUsageCount, &prefs_default_search_->usage_count); |
370 | 373 |
371 const base::ListValue* alternate_urls = NULL; | 374 const base::ListValue* alternate_urls = NULL; |
372 if (url_dict->GetList(kAlternateURLs, &alternate_urls)) { | 375 if (url_dict->GetList(kAlternateURLs, &alternate_urls)) { |
373 for (base::ListValue::const_iterator it = alternate_urls->begin(); | 376 for (base::ListValue::const_iterator it = alternate_urls->begin(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 MergePrefsDataWithPrepopulated(); | 410 MergePrefsDataWithPrepopulated(); |
408 } | 411 } |
409 | 412 |
410 void DefaultSearchManager::NotifyObserver() { | 413 void DefaultSearchManager::NotifyObserver() { |
411 if (!change_observer_.is_null()) { | 414 if (!change_observer_.is_null()) { |
412 Source source = FROM_FALLBACK; | 415 Source source = FROM_FALLBACK; |
413 TemplateURLData* data = GetDefaultSearchEngine(&source); | 416 TemplateURLData* data = GetDefaultSearchEngine(&source); |
414 change_observer_.Run(data, source); | 417 change_observer_.Run(data, source); |
415 } | 418 } |
416 } | 419 } |
OLD | NEW |