| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/profile_resetter/automatic_profile_resetter_delegate.h" | 5 #include "chrome/browser/profile_resetter/automatic_profile_resetter_delegate.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
| 35 | 35 |
| 36 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
| 37 #include "chrome/browser/enumerate_modules_model_win.h" | 37 #include "chrome/browser/enumerate_modules_model_win.h" |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 namespace { | 40 namespace { |
| 41 | 41 |
| 42 scoped_ptr<base::DictionaryValue> BuildSubTreeFromTemplateURL( | 42 scoped_ptr<base::DictionaryValue> BuildSubTreeFromTemplateURL( |
| 43 const TemplateURL* template_url) { | 43 const TemplateURL* template_url) { |
| 44 scoped_ptr<base::DictionaryValue> tree(new base::DictionaryValue); | |
| 45 tree->SetString("search_url", template_url->url()); | |
| 46 // If this value contains a placeholder in the pre-populated data, it will | 44 // If this value contains a placeholder in the pre-populated data, it will |
| 47 // have been replaced as it was loaded into a TemplateURL. | 45 // have been replaced as it was loaded into a TemplateURL. |
| 48 // BuildSubTreeFromTemplateURL works with TemplateURL (not TemplateURLData) | 46 // BuildSubTreeFromTemplateURL works with TemplateURL (not TemplateURLData) |
| 49 // in order to maintain this behaviour. | 47 // in order to maintain this behaviour. |
| 50 // TODO(engedy): Confirm the expected behaviour and convert to use | 48 // TODO(engedy): Confirm the expected behaviour and convert to use |
| 51 // TemplateURLData if possible." | 49 // TemplateURLData if possible." |
| 52 tree->SetString("search_terms_replacement_key", | 50 scoped_ptr<base::DictionaryValue> tree(new base::DictionaryValue); |
| 53 template_url->search_terms_replacement_key()); | 51 tree->SetString("name", template_url->short_name()); |
| 54 tree->SetString("suggest_url", template_url->suggestions_url()); | 52 tree->SetString("short_name", template_url->short_name()); |
| 53 tree->SetString("keyword", template_url->keyword()); |
| 54 tree->SetString("search_url", template_url->url()); |
| 55 tree->SetString("url", template_url->url()); |
| 56 tree->SetString("suggestions_url", template_url->suggestions_url()); |
| 55 tree->SetString("instant_url", template_url->instant_url()); | 57 tree->SetString("instant_url", template_url->instant_url()); |
| 56 tree->SetString("image_url", template_url->image_url()); | 58 tree->SetString("image_url", template_url->image_url()); |
| 57 tree->SetString("new_tab_url", template_url->new_tab_url()); | 59 tree->SetString("new_tab_url", template_url->new_tab_url()); |
| 58 tree->SetString("search_url_post_params", | 60 tree->SetString("search_url_post_params", |
| 59 template_url->search_url_post_params()); | 61 template_url->search_url_post_params()); |
| 60 tree->SetString("suggest_url_post_params", | 62 tree->SetString("suggestions_url_post_params", |
| 61 template_url->suggestions_url_post_params()); | 63 template_url->suggestions_url_post_params()); |
| 62 tree->SetString("instant_url_post_params", | 64 tree->SetString("instant_url_post_params", |
| 63 template_url->instant_url_post_params()); | 65 template_url->instant_url_post_params()); |
| 64 tree->SetString("image_url_post_params", | 66 tree->SetString("image_url_post_params", |
| 65 template_url->image_url_post_params()); | 67 template_url->image_url_post_params()); |
| 66 tree->SetString("icon_url", template_url->favicon_url().spec()); | |
| 67 tree->SetString("name", template_url->short_name()); | |
| 68 tree->SetString("keyword", template_url->keyword()); | |
| 69 base::ListValue* input_encodings = new base::ListValue; | |
| 70 input_encodings->AppendStrings(template_url->input_encodings()); | |
| 71 tree->Set("encodings", input_encodings); | |
| 72 tree->SetString("id", base::Int64ToString(template_url->id())); | |
| 73 tree->SetString("prepopulate_id", | |
| 74 base::IntToString(template_url->prepopulate_id())); | |
| 75 base::ListValue* alternate_urls = new base::ListValue; | 68 base::ListValue* alternate_urls = new base::ListValue; |
| 76 alternate_urls->AppendStrings(template_url->alternate_urls()); | 69 alternate_urls->AppendStrings(template_url->alternate_urls()); |
| 77 tree->Set("alternate_urls", alternate_urls); | 70 tree->Set("alternate_urls", alternate_urls); |
| 71 tree->SetString("favicon_url", template_url->favicon_url().spec()); |
| 72 tree->SetString("originating_url", template_url->originating_url().spec()); |
| 73 tree->SetBoolean("safe_for_autoreplace", |
| 74 template_url->safe_for_autoreplace()); |
| 75 base::ListValue* input_encodings = new base::ListValue; |
| 76 input_encodings->AppendStrings(template_url->input_encodings()); |
| 77 tree->Set("input_encodings", input_encodings); |
| 78 tree->SetString("id", base::Int64ToString(template_url->id())); |
| 79 tree->SetString("date_created", |
| 80 base::Int64ToString( |
| 81 template_url->date_created().ToInternalValue())); |
| 82 tree->SetString("last_modified", |
| 83 base::Int64ToString( |
| 84 template_url->last_modified().ToInternalValue())); |
| 85 tree->SetBoolean("created_by_policy", template_url->created_by_policy()); |
| 86 tree->SetInteger("usage_count", template_url->usage_count()); |
| 87 tree->SetInteger("prepopulate_id", template_url->prepopulate_id()); |
| 88 tree->SetString("search_terms_replacement_key", |
| 89 template_url->search_terms_replacement_key()); |
| 78 return tree.Pass(); | 90 return tree.Pass(); |
| 79 } | 91 } |
| 80 | 92 |
| 81 #if defined(OS_WIN) | 93 #if defined(OS_WIN) |
| 82 void ExtractLoadedModuleNameDigests( | 94 void ExtractLoadedModuleNameDigests( |
| 83 const base::ListValue& module_list, | 95 const base::ListValue& module_list, |
| 84 base::ListValue* module_name_digests) { | 96 base::ListValue* module_name_digests) { |
| 85 DCHECK(module_name_digests); | 97 DCHECK(module_name_digests); |
| 86 | 98 |
| 87 // EnumerateModulesModel produces a list of dictionaries. | 99 // EnumerateModulesModel produces a list of dictionaries. |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 if (difference) { | 388 if (difference) { |
| 377 old_settings_snapshot->Subtract(new_settings_snapshot); | 389 old_settings_snapshot->Subtract(new_settings_snapshot); |
| 378 std::string report = | 390 std::string report = |
| 379 SerializeSettingsReport(*old_settings_snapshot, difference); | 391 SerializeSettingsReport(*old_settings_snapshot, difference); |
| 380 SendFeedback(report); | 392 SendFeedback(report); |
| 381 } | 393 } |
| 382 } | 394 } |
| 383 content::BrowserThread::PostTask( | 395 content::BrowserThread::PostTask( |
| 384 content::BrowserThread::UI, FROM_HERE, user_callback); | 396 content::BrowserThread::UI, FROM_HERE, user_callback); |
| 385 } | 397 } |
| OLD | NEW |