OLD | NEW |
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 15 matching lines...) Expand all Loading... |
26 #include "chrome/common/chrome_version_info.h" | 26 #include "chrome/common/chrome_version_info.h" |
27 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
28 #include "content/public/browser/gpu_data_manager.h" | 28 #include "content/public/browser/gpu_data_manager.h" |
29 #include "content/public/browser/gpu_data_manager_observer.h" | 29 #include "content/public/browser/gpu_data_manager_observer.h" |
30 #include "content/public/browser/plugin_service.h" | 30 #include "content/public/browser/plugin_service.h" |
31 #include "content/public/browser/user_metrics.h" | 31 #include "content/public/browser/user_metrics.h" |
32 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
33 #include "content/public/browser/web_ui.h" | 33 #include "content/public/browser/web_ui.h" |
34 #include "content/public/browser/web_ui_data_source.h" | 34 #include "content/public/browser/web_ui_data_source.h" |
35 #include "content/public/browser/web_ui_message_handler.h" | 35 #include "content/public/browser/web_ui_message_handler.h" |
| 36 #include "content/public/common/webplugininfo.h" |
36 #include "gpu/config/gpu_info.h" | 37 #include "gpu/config/gpu_info.h" |
37 #include "grit/browser_resources.h" | 38 #include "grit/browser_resources.h" |
38 #include "grit/chromium_strings.h" | 39 #include "grit/chromium_strings.h" |
39 #include "grit/generated_resources.h" | 40 #include "grit/generated_resources.h" |
40 #include "grit/theme_resources.h" | 41 #include "grit/theme_resources.h" |
41 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
42 #include "ui/base/resource/resource_bundle.h" | 43 #include "ui/base/resource/resource_bundle.h" |
43 #include "webkit/plugins/plugin_constants.h" | 44 #include "webkit/plugins/plugin_constants.h" |
44 #include "webkit/plugins/webplugininfo.h" | |
45 | 45 |
46 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
47 #include "base/win/windows_version.h" | 47 #include "base/win/windows_version.h" |
48 #endif | 48 #endif |
49 | 49 |
50 using content::GpuDataManager; | 50 using content::GpuDataManager; |
51 using content::PluginService; | 51 using content::PluginService; |
52 using content::UserMetricsAction; | 52 using content::UserMetricsAction; |
53 using content::WebContents; | 53 using content::WebContents; |
54 using content::WebUIMessageHandler; | 54 using content::WebUIMessageHandler; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // CrashUploadList::Delegate implementation. | 92 // CrashUploadList::Delegate implementation. |
93 virtual void OnUploadListAvailable() OVERRIDE; | 93 virtual void OnUploadListAvailable() OVERRIDE; |
94 | 94 |
95 // GpuDataManager::Observer implementation. | 95 // GpuDataManager::Observer implementation. |
96 virtual void OnGpuInfoUpdate() OVERRIDE; | 96 virtual void OnGpuInfoUpdate() OVERRIDE; |
97 | 97 |
98 // Callback for the "requestFlashInfo" message. | 98 // Callback for the "requestFlashInfo" message. |
99 void HandleRequestFlashInfo(const ListValue* args); | 99 void HandleRequestFlashInfo(const ListValue* args); |
100 | 100 |
101 // Callback for the Flash plugin information. | 101 // Callback for the Flash plugin information. |
102 void OnGotPlugins(const std::vector<webkit::WebPluginInfo>& plugins); | 102 void OnGotPlugins(const std::vector<content::WebPluginInfo>& plugins); |
103 | 103 |
104 private: | 104 private: |
105 // Called when we think we might have enough information to return data back | 105 // Called when we think we might have enough information to return data back |
106 // to the page. | 106 // to the page. |
107 void MaybeRespondToPage(); | 107 void MaybeRespondToPage(); |
108 | 108 |
109 // In certain cases we might not get called back from the GPU process so we | 109 // In certain cases we might not get called back from the GPU process so we |
110 // set an upper limit on the time we wait. This function gets called when the | 110 // set an upper limit on the time we wait. This function gets called when the |
111 // time has passed. This actually doesn't prevent the rest of the information | 111 // time has passed. This actually doesn't prevent the rest of the information |
112 // to appear later, the page will just reflow when more information becomes | 112 // to appear later, the page will just reflow when more information becomes |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 page_has_requested_data_ = true; | 196 page_has_requested_data_ = true; |
197 MaybeRespondToPage(); | 197 MaybeRespondToPage(); |
198 } | 198 } |
199 | 199 |
200 void FlashDOMHandler::OnGpuInfoUpdate() { | 200 void FlashDOMHandler::OnGpuInfoUpdate() { |
201 has_gpu_info_ = true; | 201 has_gpu_info_ = true; |
202 MaybeRespondToPage(); | 202 MaybeRespondToPage(); |
203 } | 203 } |
204 | 204 |
205 void FlashDOMHandler::OnGotPlugins( | 205 void FlashDOMHandler::OnGotPlugins( |
206 const std::vector<webkit::WebPluginInfo>& plugins) { | 206 const std::vector<content::WebPluginInfo>& plugins) { |
207 has_plugin_info_ = true; | 207 has_plugin_info_ = true; |
208 MaybeRespondToPage(); | 208 MaybeRespondToPage(); |
209 } | 209 } |
210 | 210 |
211 void FlashDOMHandler::OnTimeout() { | 211 void FlashDOMHandler::OnTimeout() { |
212 // We don't set page_has_requested_data_ because that is guaranteed to appear | 212 // We don't set page_has_requested_data_ because that is guaranteed to appear |
213 // and we shouldn't be responding to the page before then. | 213 // and we shouldn't be responding to the page before then. |
214 has_gpu_info_ = true; | 214 has_gpu_info_ = true; |
215 crash_list_available_ = true; | 215 crash_list_available_ = true; |
216 has_plugin_info_ = true; | 216 has_plugin_info_ = true; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 259 } |
260 os_label += " SP" + base::IntToString(os->service_pack().major); | 260 os_label += " SP" + base::IntToString(os->service_pack().major); |
261 if (os->service_pack().minor > 0) | 261 if (os->service_pack().minor > 0) |
262 os_label += "." + base::IntToString(os->service_pack().minor); | 262 os_label += "." + base::IntToString(os->service_pack().minor); |
263 if (os->architecture() == base::win::OSInfo::X64_ARCHITECTURE) | 263 if (os->architecture() == base::win::OSInfo::X64_ARCHITECTURE) |
264 os_label += " 64 bit"; | 264 os_label += " 64 bit"; |
265 #endif | 265 #endif |
266 AddPair(list, l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_OS), os_label); | 266 AddPair(list, l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_OS), os_label); |
267 | 267 |
268 // Obtain the version of the Flash plugins. | 268 // Obtain the version of the Flash plugins. |
269 std::vector<webkit::WebPluginInfo> info_array; | 269 std::vector<content::WebPluginInfo> info_array; |
270 PluginService::GetInstance()->GetPluginInfoArray( | 270 PluginService::GetInstance()->GetPluginInfoArray( |
271 GURL(), kFlashPluginSwfMimeType, false, &info_array, NULL); | 271 GURL(), kFlashPluginSwfMimeType, false, &info_array, NULL); |
272 if (info_array.empty()) { | 272 if (info_array.empty()) { |
273 AddPair(list, ASCIIToUTF16(kFlashPlugin), "Not installed"); | 273 AddPair(list, ASCIIToUTF16(kFlashPlugin), "Not installed"); |
274 } else { | 274 } else { |
275 PluginPrefs* plugin_prefs = | 275 PluginPrefs* plugin_prefs = |
276 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())).get(); | 276 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())).get(); |
277 bool found_enabled = false; | 277 bool found_enabled = false; |
278 for (size_t i = 0; i < info_array.size(); ++i) { | 278 for (size_t i = 0; i < info_array.size(); ++i) { |
279 string16 flash_version = info_array[i].version + ASCIIToUTF16(" ") + | 279 string16 flash_version = info_array[i].version + ASCIIToUTF16(" ") + |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 Profile* profile = Profile::FromWebUI(web_ui); | 390 Profile* profile = Profile::FromWebUI(web_ui); |
391 content::WebUIDataSource::Add(profile, CreateFlashUIHTMLSource()); | 391 content::WebUIDataSource::Add(profile, CreateFlashUIHTMLSource()); |
392 } | 392 } |
393 | 393 |
394 // static | 394 // static |
395 base::RefCountedMemory* FlashUI::GetFaviconResourceBytes( | 395 base::RefCountedMemory* FlashUI::GetFaviconResourceBytes( |
396 ui::ScaleFactor scale_factor) { | 396 ui::ScaleFactor scale_factor) { |
397 // Use the default icon for now. | 397 // Use the default icon for now. |
398 return NULL; | 398 return NULL; |
399 } | 399 } |
OLD | NEW |