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

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

Issue 10990078: Cleanup: Use plugin constants in more places. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 8 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
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | chrome/browser/ui/webui/version_handler.cc » ('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 (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/flash_ui.h" 5 #include "chrome/browser/ui/webui/flash_ui.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 23 matching lines...) Expand all
34 #include "content/public/browser/web_contents.h" 34 #include "content/public/browser/web_contents.h"
35 #include "content/public/browser/web_ui.h" 35 #include "content/public/browser/web_ui.h"
36 #include "content/public/browser/web_ui_message_handler.h" 36 #include "content/public/browser/web_ui_message_handler.h"
37 #include "content/public/common/gpu_info.h" 37 #include "content/public/common/gpu_info.h"
38 #include "grit/browser_resources.h" 38 #include "grit/browser_resources.h"
39 #include "grit/chromium_strings.h" 39 #include "grit/chromium_strings.h"
40 #include "grit/generated_resources.h" 40 #include "grit/generated_resources.h"
41 #include "grit/theme_resources.h" 41 #include "grit/theme_resources.h"
42 #include "ui/base/l10n/l10n_util.h" 42 #include "ui/base/l10n/l10n_util.h"
43 #include "ui/base/resource/resource_bundle.h" 43 #include "ui/base/resource/resource_bundle.h"
44 #include "webkit/plugins/plugin_constants.h"
44 #include "webkit/plugins/webplugininfo.h" 45 #include "webkit/plugins/webplugininfo.h"
45 46
46 #if defined(OS_WIN) 47 #if defined(OS_WIN)
47 #include "base/win/windows_version.h" 48 #include "base/win/windows_version.h"
48 #endif 49 #endif
49 50
50 using content::GpuDataManager; 51 using content::GpuDataManager;
51 using content::PluginService; 52 using content::PluginService;
52 using content::UserMetricsAction; 53 using content::UserMetricsAction;
53 using content::WebContents; 54 using content::WebContents;
54 using content::WebUIMessageHandler; 55 using content::WebUIMessageHandler;
55 56
56 namespace { 57 namespace {
57 58
59 const char kFlashPlugin[] = "Flash plugin";
60
58 ChromeWebUIDataSource* CreateFlashUIHTMLSource() { 61 ChromeWebUIDataSource* CreateFlashUIHTMLSource() {
59 ChromeWebUIDataSource* source = 62 ChromeWebUIDataSource* source =
60 new ChromeWebUIDataSource(chrome::kChromeUIFlashHost); 63 new ChromeWebUIDataSource(chrome::kChromeUIFlashHost);
61 64
62 source->AddLocalizedString("loadingMessage", IDS_FLASH_LOADING_MESSAGE); 65 source->AddLocalizedString("loadingMessage", IDS_FLASH_LOADING_MESSAGE);
63 source->AddLocalizedString("flashLongTitle", IDS_FLASH_TITLE_MESSAGE); 66 source->AddLocalizedString("flashLongTitle", IDS_FLASH_TITLE_MESSAGE);
64 source->set_json_path("strings.js"); 67 source->set_json_path("strings.js");
65 source->add_resource_path("about_flash.js", IDR_ABOUT_FLASH_JS); 68 source->add_resource_path("about_flash.js", IDR_ABOUT_FLASH_JS);
66 source->set_default_resource(IDR_ABOUT_FLASH_HTML); 69 source->set_default_resource(IDR_ABOUT_FLASH_HTML);
67 return source; 70 return source;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 if (os->service_pack().minor > 0) 263 if (os->service_pack().minor > 0)
261 os_label += "." + base::IntToString(os->service_pack().minor); 264 os_label += "." + base::IntToString(os->service_pack().minor);
262 if (os->architecture() == base::win::OSInfo::X64_ARCHITECTURE) 265 if (os->architecture() == base::win::OSInfo::X64_ARCHITECTURE)
263 os_label += " 64 bit"; 266 os_label += " 64 bit";
264 #endif 267 #endif
265 AddPair(list, l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_OS), os_label); 268 AddPair(list, l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_OS), os_label);
266 269
267 // Obtain the version of the Flash plugins. 270 // Obtain the version of the Flash plugins.
268 std::vector<webkit::WebPluginInfo> info_array; 271 std::vector<webkit::WebPluginInfo> info_array;
269 PluginService::GetInstance()->GetPluginInfoArray( 272 PluginService::GetInstance()->GetPluginInfoArray(
270 GURL(), "application/x-shockwave-flash", false, &info_array, NULL); 273 GURL(), kFlashPluginSwfMimeType, false, &info_array, NULL);
271 string16 flash_version; 274 string16 flash_version;
272 if (info_array.empty()) { 275 if (info_array.empty()) {
273 AddPair(list, ASCIIToUTF16("Flash plugin"), "Disabled"); 276 AddPair(list, ASCIIToUTF16(kFlashPlugin), "Disabled");
274 } else { 277 } else {
275 PluginPrefs* plugin_prefs = 278 PluginPrefs* plugin_prefs =
276 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())); 279 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui()));
277 for (size_t i = 0; i < info_array.size(); ++i) { 280 for (size_t i = 0; i < info_array.size(); ++i) {
278 if (plugin_prefs->IsPluginEnabled(info_array[i])) { 281 if (plugin_prefs->IsPluginEnabled(info_array[i])) {
279 flash_version = info_array[i].version + ASCIIToUTF16(" ") + 282 flash_version = info_array[i].version + ASCIIToUTF16(" ") +
280 info_array[i].path.LossyDisplayName(); 283 info_array[i].path.LossyDisplayName();
281 if (i != 0) 284 if (i != 0)
282 flash_version += ASCIIToUTF16(" (not used)"); 285 flash_version += ASCIIToUTF16(" (not used)");
283 AddPair(list, ASCIIToUTF16("Flash plugin"), flash_version); 286 AddPair(list, ASCIIToUTF16(kFlashPlugin), flash_version);
284 } 287 }
285 } 288 }
286 } 289 }
287 290
288 // Crash information. 291 // Crash information.
289 AddPair(list, string16(), "--- Crash data ---"); 292 AddPair(list, string16(), "--- Crash data ---");
290 bool crash_reporting_enabled = CrashesUI::CrashReportingEnabled(); 293 bool crash_reporting_enabled = CrashesUI::CrashReportingEnabled();
291 if (crash_reporting_enabled) { 294 if (crash_reporting_enabled) {
292 std::vector<CrashUploadList::CrashInfo> crashes; 295 std::vector<CrashUploadList::CrashInfo> crashes;
293 upload_list_->GetUploadedCrashes(10, &crashes); 296 upload_list_->GetUploadedCrashes(10, &crashes);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 Profile* profile = Profile::FromWebUI(web_ui); 383 Profile* profile = Profile::FromWebUI(web_ui);
381 ChromeURLDataManager::AddDataSource(profile, CreateFlashUIHTMLSource()); 384 ChromeURLDataManager::AddDataSource(profile, CreateFlashUIHTMLSource());
382 } 385 }
383 386
384 // static 387 // static
385 base::RefCountedMemory* FlashUI::GetFaviconResourceBytes( 388 base::RefCountedMemory* FlashUI::GetFaviconResourceBytes(
386 ui::ScaleFactor scale_factor) { 389 ui::ScaleFactor scale_factor) {
387 // Use the default icon for now. 390 // Use the default icon for now.
388 return NULL; 391 return NULL;
389 } 392 }
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | chrome/browser/ui/webui/version_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698