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

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

Issue 461633002: Refactor language detection logic to allow non-static CLD data sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Create a factory for test harnesses and use it Created 6 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 | Annotate | Revision Log
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"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 std::string cld_version = ""; 64 std::string cld_version = "";
65 std::string cld_data_source = ""; 65 std::string cld_data_source = "";
66 // The version strings are hardcoded here to avoid linking with the CLD 66 // The version strings are hardcoded here to avoid linking with the CLD
67 // library, see http://crbug.com/297777. 67 // library, see http://crbug.com/297777.
68 #if CLD_VERSION==1 68 #if CLD_VERSION==1
69 cld_version = "1.6"; 69 cld_version = "1.6";
70 cld_data_source = "static"; // CLD1.x does not support dynamic data loading 70 cld_data_source = "static"; // CLD1.x does not support dynamic data loading
71 #elif CLD_VERSION==2 71 #elif CLD_VERSION==2
72 cld_version = "2"; 72 cld_version = "2";
73 cld_data_source = translate::CldDataSource::GetName(); 73 cld_data_source = translate::CldDataSource::Get()->GetName();
74 #else 74 #else
75 NOTREACHED(); 75 NOTREACHED();
76 #endif 76 #endif
77 source->AddString("cld-version", cld_version); 77 source->AddString("cld-version", cld_version);
78 source->AddString("cld-data-source", cld_data_source); 78 source->AddString("cld-data-source", cld_data_source);
79 79
80 return source; 80 return source;
81 } 81 }
82 82
83 } // namespace 83 } // namespace
84 84
85 TranslateInternalsUI::TranslateInternalsUI(content::WebUI* web_ui) 85 TranslateInternalsUI::TranslateInternalsUI(content::WebUI* web_ui)
86 : WebUIController(web_ui) { 86 : WebUIController(web_ui) {
87 web_ui->AddMessageHandler(new TranslateInternalsHandler); 87 web_ui->AddMessageHandler(new TranslateInternalsHandler);
88 88
89 Profile* profile = Profile::FromWebUI(web_ui); 89 Profile* profile = Profile::FromWebUI(web_ui);
90 content::WebUIDataSource::Add(profile, CreateTranslateInternalsHTMLSource()); 90 content::WebUIDataSource::Add(profile, CreateTranslateInternalsHTMLSource());
91 } 91 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698