| 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/ui/webui/translate_internals/translate_internals_handle
r.h" | 5 #include "chrome/browser/ui/webui/translate_internals/translate_internals_handle
r.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 new base::FundamentalValue(details.time.ToJsTime())); | 40 new base::FundamentalValue(details.time.ToJsTime())); |
| 41 dict.Set("url", | 41 dict.Set("url", |
| 42 new base::StringValue(details.url.spec())); | 42 new base::StringValue(details.url.spec())); |
| 43 dict.Set("content_language", | 43 dict.Set("content_language", |
| 44 new base::StringValue(details.content_language)); | 44 new base::StringValue(details.content_language)); |
| 45 dict.Set("cld_language", | 45 dict.Set("cld_language", |
| 46 new base::StringValue(details.cld_language)); | 46 new base::StringValue(details.cld_language)); |
| 47 dict.Set("is_cld_reliable", | 47 dict.Set("is_cld_reliable", |
| 48 new base::FundamentalValue(details.is_cld_reliable)); | 48 new base::FundamentalValue(details.is_cld_reliable)); |
| 49 dict.Set("language", new base::StringValue(details.adopted_language)); | 49 dict.Set("language", new base::StringValue(details.adopted_language)); |
| 50 dict.Set("content", new base::StringValue(details.contents)); |
| 50 SendMessageToJs("languageDetectionInfoAdded", dict); | 51 SendMessageToJs("languageDetectionInfoAdded", dict); |
| 51 } | 52 } |
| 52 | 53 |
| 53 void TranslateInternalsHandler::OnRemovePrefItem(const base::ListValue* args) { | 54 void TranslateInternalsHandler::OnRemovePrefItem(const base::ListValue* args) { |
| 54 content::WebContents* web_contents = web_ui()->GetWebContents(); | 55 content::WebContents* web_contents = web_ui()->GetWebContents(); |
| 55 Profile* profile = | 56 Profile* profile = |
| 56 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 57 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 57 PrefService* prefs = profile->GetOriginalProfile()->GetPrefs(); | 58 PrefService* prefs = profile->GetOriginalProfile()->GetPrefs(); |
| 58 TranslatePrefs translate_prefs(prefs); | 59 TranslatePrefs translate_prefs(prefs); |
| 59 | 60 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 117 |
| 117 for (size_t i = 0; i < arraysize(keys); ++i) { | 118 for (size_t i = 0; i < arraysize(keys); ++i) { |
| 118 const char* key = keys[i]; | 119 const char* key = keys[i]; |
| 119 const PrefService::Preference* pref = prefs->FindPreference(key); | 120 const PrefService::Preference* pref = prefs->FindPreference(key); |
| 120 if (pref) | 121 if (pref) |
| 121 dict.Set(key, pref->GetValue()->DeepCopy()); | 122 dict.Set(key, pref->GetValue()->DeepCopy()); |
| 122 } | 123 } |
| 123 | 124 |
| 124 SendMessageToJs("prefsUpdated", dict); | 125 SendMessageToJs("prefsUpdated", dict); |
| 125 } | 126 } |
| OLD | NEW |