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_ui.h" | 5 #include "chrome/browser/ui/webui/translate_internals/translate_internals_ui.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/webui/translate_internals/translate_internals_handle
r.h" | 14 #include "chrome/browser/ui/webui/translate_internals/translate_internals_handle
r.h" |
15 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
17 #include "content/public/browser/web_ui.h" | 17 #include "content/public/browser/web_ui.h" |
18 #include "content/public/browser/web_ui_data_source.h" | 18 #include "content/public/browser/web_ui_data_source.h" |
19 #include "grit/browser_resources.h" | 19 #include "grit/browser_resources.h" |
20 #include "grit/translate_internals_resources.h" | 20 #include "grit/translate_internals_resources.h" |
21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
22 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
23 | 23 |
24 using content::WebContents; | |
25 | |
26 namespace { | 24 namespace { |
27 | 25 |
28 // Sets the languages to |dict|. Each key is a language code and each value is | 26 // Sets the languages to |dict|. Each key is a language code and each value is |
29 // a language name in the locale. | 27 // a language name in the locale. |
30 void GetLanguages(base::DictionaryValue* dict) { | 28 void GetLanguages(base::DictionaryValue* dict) { |
31 DCHECK(dict); | 29 DCHECK(dict); |
32 | 30 |
33 const std::string app_locale = g_browser_process->GetApplicationLocale(); | 31 const std::string app_locale = g_browser_process->GetApplicationLocale(); |
34 std::vector<std::string> language_codes; | 32 std::vector<std::string> language_codes; |
35 l10n_util::GetAcceptLanguagesForLocale(app_locale, &language_codes); | 33 l10n_util::GetAcceptLanguagesForLocale(app_locale, &language_codes); |
(...skipping 29 matching lines...) Expand all Loading... |
65 | 63 |
66 } // namespace | 64 } // namespace |
67 | 65 |
68 TranslateInternalsUI::TranslateInternalsUI(content::WebUI* web_ui) | 66 TranslateInternalsUI::TranslateInternalsUI(content::WebUI* web_ui) |
69 : WebUIController(web_ui) { | 67 : WebUIController(web_ui) { |
70 web_ui->AddMessageHandler(new TranslateInternalsHandler); | 68 web_ui->AddMessageHandler(new TranslateInternalsHandler); |
71 | 69 |
72 Profile* profile = Profile::FromWebUI(web_ui); | 70 Profile* profile = Profile::FromWebUI(web_ui); |
73 content::WebUIDataSource::Add(profile, CreateTranslateInternalsHTMLSource()); | 71 content::WebUIDataSource::Add(profile, CreateTranslateInternalsHTMLSource()); |
74 } | 72 } |
OLD | NEW |