Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc

Issue 25531002: Move language detection to a component (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Run translate unittests on iOS Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/startup/bad_flags_prompt.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/command_line.h" 10 #include "base/command_line.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/webui/translate_internals/translate_internals_handle r.h" 15 #include "chrome/browser/ui/webui/translate_internals/translate_internals_handle r.h"
16 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/translate/language_detection_util.h"
18 #include "chrome/common/url_constants.h" 17 #include "chrome/common/url_constants.h"
18 #include "components/translate/language_detection/language_detection_util.h"
19 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
20 #include "content/public/browser/web_ui.h" 20 #include "content/public/browser/web_ui.h"
21 #include "content/public/browser/web_ui_data_source.h" 21 #include "content/public/browser/web_ui_data_source.h"
22 #include "grit/browser_resources.h" 22 #include "grit/browser_resources.h"
23 #include "grit/translate_internals_resources.h" 23 #include "grit/translate_internals_resources.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/base/resource/resource_bundle.h" 25 #include "ui/base/resource/resource_bundle.h"
26 26
27 namespace { 27 namespace {
28 28
(...skipping 25 matching lines...) Expand all
54 54
55 base::DictionaryValue langs; 55 base::DictionaryValue langs;
56 GetLanguages(&langs); 56 GetLanguages(&langs);
57 for (base::DictionaryValue::Iterator it(langs); !it.IsAtEnd(); it.Advance()) { 57 for (base::DictionaryValue::Iterator it(langs); !it.IsAtEnd(); it.Advance()) {
58 std::string key = "language-" + it.key(); 58 std::string key = "language-" + it.key();
59 std::string value; 59 std::string value;
60 it.value().GetAsString(&value); 60 it.value().GetAsString(&value);
61 source->AddString(key, value); 61 source->AddString(key, value);
62 } 62 }
63 63
64 std::string cld_version = LanguageDetectionUtil::GetCLDVersion(); 64 // TODO(droger): Do not call GetCLDVersion() from here. Use a constant string
65 // instead, see http://crbug.com/297777.
66 std::string cld_version = translate::GetCLDVersion();
65 source->AddString("cld-version", cld_version); 67 source->AddString("cld-version", cld_version);
66 68
67 return source; 69 return source;
68 } 70 }
69 71
70 } // namespace 72 } // namespace
71 73
72 TranslateInternalsUI::TranslateInternalsUI(content::WebUI* web_ui) 74 TranslateInternalsUI::TranslateInternalsUI(content::WebUI* web_ui)
73 : WebUIController(web_ui) { 75 : WebUIController(web_ui) {
74 web_ui->AddMessageHandler(new TranslateInternalsHandler); 76 web_ui->AddMessageHandler(new TranslateInternalsHandler);
75 77
76 Profile* profile = Profile::FromWebUI(web_ui); 78 Profile* profile = Profile::FromWebUI(web_ui);
77 content::WebUIDataSource::Add(profile, CreateTranslateInternalsHTMLSource()); 79 content::WebUIDataSource::Add(profile, CreateTranslateInternalsHTMLSource());
78 } 80 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/bad_flags_prompt.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698