| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/i18n/time_formatting.h" | 13 #include "base/i18n/time_formatting.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/string16.h" | 15 #include "base/string16.h" |
| 16 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
| 17 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
| 18 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
| 19 #include "base/timer.h" | 19 #include "base/timer.h" |
| 20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
| 21 #include "base/values.h" | 21 #include "base/values.h" |
| 22 #include "chrome/browser/crash_upload_list.h" | 22 #include "chrome/browser/crash_upload_list.h" |
| 23 #include "chrome/browser/plugin_prefs.h" | 23 #include "chrome/browser/plugin_prefs.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 25 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| 26 #include "chrome/browser/ui/webui/crashes_ui.h" | 26 #include "chrome/browser/ui/webui/crashes_ui.h" |
| 27 #include "chrome/common/chrome_version_info.h" | 27 #include "chrome/common/chrome_version_info.h" |
| 28 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
| 29 #include "content/browser/gpu/gpu_data_manager.h" | 29 #include "content/browser/gpu/gpu_data_manager.h" |
| 30 #include "content/browser/tab_contents/tab_contents.h" | 30 #include "content/public/browser/web_contents.h" |
| 31 #include "content/public/browser/plugin_service.h" | 31 #include "content/public/browser/plugin_service.h" |
| 32 #include "content/public/browser/user_metrics.h" | 32 #include "content/public/browser/user_metrics.h" |
| 33 #include "grit/browser_resources.h" | 33 #include "grit/browser_resources.h" |
| 34 #include "grit/chromium_strings.h" | 34 #include "grit/chromium_strings.h" |
| 35 #include "grit/generated_resources.h" | 35 #include "grit/generated_resources.h" |
| 36 #include "grit/theme_resources.h" | 36 #include "grit/theme_resources.h" |
| 37 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
| 38 #include "ui/base/resource/resource_bundle.h" | 38 #include "ui/base/resource/resource_bundle.h" |
| 39 #include "webkit/plugins/webplugininfo.h" | 39 #include "webkit/plugins/webplugininfo.h" |
| 40 | 40 |
| 41 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
| 42 #include "base/win/windows_version.h" | 42 #include "base/win/windows_version.h" |
| 43 #endif | 43 #endif |
| 44 | 44 |
| 45 using content::PluginService; | 45 using content::PluginService; |
| 46 using content::UserMetricsAction; | 46 using content::UserMetricsAction; |
| 47 using content::WebContents; |
| 47 | 48 |
| 48 namespace { | 49 namespace { |
| 49 | 50 |
| 50 ChromeWebUIDataSource* CreateFlashUIHTMLSource() { | 51 ChromeWebUIDataSource* CreateFlashUIHTMLSource() { |
| 51 ChromeWebUIDataSource* source = | 52 ChromeWebUIDataSource* source = |
| 52 new ChromeWebUIDataSource(chrome::kChromeUIFlashHost); | 53 new ChromeWebUIDataSource(chrome::kChromeUIFlashHost); |
| 53 | 54 |
| 54 source->AddLocalizedString("loadingMessage", IDS_FLASH_LOADING_MESSAGE); | 55 source->AddLocalizedString("loadingMessage", IDS_FLASH_LOADING_MESSAGE); |
| 55 source->AddLocalizedString("flashLongTitle", IDS_FLASH_TITLE_MESSAGE); | 56 source->AddLocalizedString("flashLongTitle", IDS_FLASH_TITLE_MESSAGE); |
| 56 source->set_json_path("strings.js"); | 57 source->set_json_path("strings.js"); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 358 } |
| 358 | 359 |
| 359 } // namespace | 360 } // namespace |
| 360 | 361 |
| 361 /////////////////////////////////////////////////////////////////////////////// | 362 /////////////////////////////////////////////////////////////////////////////// |
| 362 // | 363 // |
| 363 // FlashUI | 364 // FlashUI |
| 364 // | 365 // |
| 365 /////////////////////////////////////////////////////////////////////////////// | 366 /////////////////////////////////////////////////////////////////////////////// |
| 366 | 367 |
| 367 FlashUI::FlashUI(TabContents* contents) : ChromeWebUI(contents) { | 368 FlashUI::FlashUI(WebContents* contents) : ChromeWebUI(contents) { |
| 368 content::RecordAction( | 369 content::RecordAction( |
| 369 UserMetricsAction("ViewAboutFlash")); | 370 UserMetricsAction("ViewAboutFlash")); |
| 370 | 371 |
| 371 AddMessageHandler(new FlashDOMHandler()); | 372 AddMessageHandler(new FlashDOMHandler()); |
| 372 | 373 |
| 373 // Set up the about:flash source. | 374 // Set up the about:flash source. |
| 374 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 375 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
| 375 profile->GetChromeURLDataManager()->AddDataSource(CreateFlashUIHTMLSource()); | 376 profile->GetChromeURLDataManager()->AddDataSource(CreateFlashUIHTMLSource()); |
| 376 } | 377 } |
| 377 | 378 |
| 378 // static | 379 // static |
| 379 RefCountedMemory* FlashUI::GetFaviconResourceBytes() { | 380 RefCountedMemory* FlashUI::GetFaviconResourceBytes() { |
| 380 // Use the default icon for now. | 381 // Use the default icon for now. |
| 381 return NULL; | 382 return NULL; |
| 382 } | 383 } |
| OLD | NEW |