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

Side by Side Diff: chrome/browser/ui/webui/nacl_ui.cc

Issue 19894003: Move webplugininfo.h to content/public. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/nacl_ui.h" 5 #include "chrome/browser/ui/webui/nacl_ui.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/common/chrome_paths.h" 22 #include "chrome/common/chrome_paths.h"
23 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/chrome_version_info.h" 24 #include "chrome/common/chrome_version_info.h"
25 #include "chrome/common/url_constants.h" 25 #include "chrome/common/url_constants.h"
26 #include "content/public/browser/plugin_service.h" 26 #include "content/public/browser/plugin_service.h"
27 #include "content/public/browser/user_metrics.h" 27 #include "content/public/browser/user_metrics.h"
28 #include "content/public/browser/web_ui.h" 28 #include "content/public/browser/web_ui.h"
29 #include "content/public/browser/web_ui_data_source.h" 29 #include "content/public/browser/web_ui_data_source.h"
30 #include "content/public/browser/web_ui_message_handler.h" 30 #include "content/public/browser/web_ui_message_handler.h"
31 #include "content/public/common/webplugininfo.h"
31 #include "grit/browser_resources.h" 32 #include "grit/browser_resources.h"
32 #include "grit/chromium_strings.h" 33 #include "grit/chromium_strings.h"
33 #include "grit/generated_resources.h" 34 #include "grit/generated_resources.h"
34 #include "grit/theme_resources.h" 35 #include "grit/theme_resources.h"
35 #include "ui/base/l10n/l10n_util.h" 36 #include "ui/base/l10n/l10n_util.h"
36 #include "ui/base/resource/resource_bundle.h" 37 #include "ui/base/resource/resource_bundle.h"
37 #include "webkit/plugins/webplugininfo.h"
38 38
39 #if defined(OS_WIN) 39 #if defined(OS_WIN)
40 #include "base/win/windows_version.h" 40 #include "base/win/windows_version.h"
41 #endif 41 #endif
42 42
43 using content::BrowserThread; 43 using content::BrowserThread;
44 using content::PluginService; 44 using content::PluginService;
45 using content::UserMetricsAction; 45 using content::UserMetricsAction;
46 using content::WebUIMessageHandler; 46 using content::WebUIMessageHandler;
47 47
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 NaClDomHandler(); 102 NaClDomHandler();
103 virtual ~NaClDomHandler(); 103 virtual ~NaClDomHandler();
104 104
105 // WebUIMessageHandler implementation. 105 // WebUIMessageHandler implementation.
106 virtual void RegisterMessages() OVERRIDE; 106 virtual void RegisterMessages() OVERRIDE;
107 107
108 // Callback for the "requestNaClInfo" message. 108 // Callback for the "requestNaClInfo" message.
109 void HandleRequestNaClInfo(const ListValue* args); 109 void HandleRequestNaClInfo(const ListValue* args);
110 110
111 // Callback for the NaCl plugin information. 111 // Callback for the NaCl plugin information.
112 void OnGotPlugins(const std::vector<webkit::WebPluginInfo>& plugins); 112 void OnGotPlugins(const std::vector<content::WebPluginInfo>& plugins);
113 113
114 // A helper callback that receives the result of checking if PNaCl path 114 // A helper callback that receives the result of checking if PNaCl path
115 // exists. |is_valid| is true if the PNaCl path that was returned by 115 // exists. |is_valid| is true if the PNaCl path that was returned by
116 // PathService is valid, and false otherwise. 116 // PathService is valid, and false otherwise.
117 void DidValidatePnaclPath(bool is_valid); 117 void DidValidatePnaclPath(bool is_valid);
118 118
119 private: 119 private:
120 // Called when enough information is gathered to return data back to the page. 120 // Called when enough information is gathered to return data back to the page.
121 void MaybeRespondToPage(); 121 void MaybeRespondToPage();
122 122
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 void NaClDomHandler::HandleRequestNaClInfo(const ListValue* args) { 229 void NaClDomHandler::HandleRequestNaClInfo(const ListValue* args) {
230 page_has_requested_data_ = true; 230 page_has_requested_data_ = true;
231 // Force re-validation of pnacl's path in the next call to 231 // Force re-validation of pnacl's path in the next call to
232 // MaybeRespondToPage(), in case PNaCl went from not-installed 232 // MaybeRespondToPage(), in case PNaCl went from not-installed
233 // to installed since the request. 233 // to installed since the request.
234 pnacl_path_validated_ = false; 234 pnacl_path_validated_ = false;
235 MaybeRespondToPage(); 235 MaybeRespondToPage();
236 } 236 }
237 237
238 void NaClDomHandler::OnGotPlugins( 238 void NaClDomHandler::OnGotPlugins(
239 const std::vector<webkit::WebPluginInfo>& plugins) { 239 const std::vector<content::WebPluginInfo>& plugins) {
240 has_plugin_info_ = true; 240 has_plugin_info_ = true;
241 MaybeRespondToPage(); 241 MaybeRespondToPage();
242 } 242 }
243 243
244 void NaClDomHandler::PopulatePageInformation(DictionaryValue* naclInfo) { 244 void NaClDomHandler::PopulatePageInformation(DictionaryValue* naclInfo) {
245 DCHECK(pnacl_path_validated_); 245 DCHECK(pnacl_path_validated_);
246 // Store Key-Value pairs of about-information. 246 // Store Key-Value pairs of about-information.
247 scoped_ptr<ListValue> list(new ListValue()); 247 scoped_ptr<ListValue> list(new ListValue());
248 248
249 // Obtain the Chrome version info. 249 // Obtain the Chrome version info.
(...skipping 25 matching lines...) Expand all
275 if (os->architecture() == base::win::OSInfo::X64_ARCHITECTURE) 275 if (os->architecture() == base::win::OSInfo::X64_ARCHITECTURE)
276 os_label += " 64 bit"; 276 os_label += " 64 bit";
277 #endif 277 #endif
278 AddPair(list.get(), 278 AddPair(list.get(),
279 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_OS), 279 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_OS),
280 ASCIIToUTF16(os_label)); 280 ASCIIToUTF16(os_label));
281 281
282 AddLineBreak(list.get()); 282 AddLineBreak(list.get());
283 283
284 // Obtain the version of the NaCl plugin. 284 // Obtain the version of the NaCl plugin.
285 std::vector<webkit::WebPluginInfo> info_array; 285 std::vector<content::WebPluginInfo> info_array;
286 PluginService::GetInstance()->GetPluginInfoArray( 286 PluginService::GetInstance()->GetPluginInfoArray(
287 GURL(), "application/x-nacl", false, &info_array, NULL); 287 GURL(), "application/x-nacl", false, &info_array, NULL);
288 string16 nacl_version; 288 string16 nacl_version;
289 string16 nacl_key = ASCIIToUTF16("NaCl plugin"); 289 string16 nacl_key = ASCIIToUTF16("NaCl plugin");
290 if (info_array.empty()) { 290 if (info_array.empty()) {
291 AddPair(list.get(), nacl_key, ASCIIToUTF16("Disabled")); 291 AddPair(list.get(), nacl_key, ASCIIToUTF16("Disabled"));
292 } else { 292 } else {
293 PluginPrefs* plugin_prefs = 293 PluginPrefs* plugin_prefs =
294 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())).get(); 294 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())).get();
295 295
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 376
377 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { 377 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) {
378 content::RecordAction(UserMetricsAction("ViewAboutNaCl")); 378 content::RecordAction(UserMetricsAction("ViewAboutNaCl"));
379 379
380 web_ui->AddMessageHandler(new NaClDomHandler()); 380 web_ui->AddMessageHandler(new NaClDomHandler());
381 381
382 // Set up the about:nacl source. 382 // Set up the about:nacl source.
383 Profile* profile = Profile::FromWebUI(web_ui); 383 Profile* profile = Profile::FromWebUI(web_ui);
384 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); 384 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource());
385 } 385 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698