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

Side by Side Diff: chrome/browser/hang_monitor/hung_plugin_action.cc

Issue 10823434: [6] Moves CreateVersionFromString to plugin_utils and updates the callers. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 2nd CL in series to delete PluginGroup. Created 8 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/plugin_finder.h » ('j') | chrome/browser/plugin_finder.cc » ('J')
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 <windows.h> 5 #include <windows.h>
6 6
7 #include "chrome/browser/hang_monitor/hung_plugin_action.h" 7 #include "chrome/browser/hang_monitor/hung_plugin_action.h"
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/version.h" 10 #include "base/version.h"
11 #include "chrome/browser/ui/simple_message_box.h" 11 #include "chrome/browser/ui/simple_message_box.h"
12 #include "chrome/common/logging_chrome.h" 12 #include "chrome/common/logging_chrome.h"
13 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
14 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
15 #include "ui/base/win/hwnd_util.h" 15 #include "ui/base/win/hwnd_util.h"
16 #include "webkit/plugins/npapi/plugin_group.h" 16 #include "webkit/plugins/npapi/plugin_group.h"
17 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" 17 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
18 #include "webkit/plugins/webplugininfo.h"
18 19
19 namespace { 20 namespace {
20 21
21 const wchar_t kGTalkPluginName[] = L"Google Talk Plugin"; 22 const wchar_t kGTalkPluginName[] = L"Google Talk Plugin";
22 const int kGTalkPluginLogMinVersion = 26; // For version 2.6 and below. 23 const int kGTalkPluginLogMinVersion = 26; // For version 2.6 and below.
23 24
24 enum GTalkPluginLogVersion { 25 enum GTalkPluginLogVersion {
25 GTALK_PLUGIN_VERSION_MIN = 0, 26 GTALK_PLUGIN_VERSION_MIN = 0,
26 GTALK_PLUGIN_VERSION_27, 27 GTALK_PLUGIN_VERSION_27,
27 GTALK_PLUGIN_VERSION_28, 28 GTALK_PLUGIN_VERSION_28,
28 GTALK_PLUGIN_VERSION_29, 29 GTALK_PLUGIN_VERSION_29,
29 GTALK_PLUGIN_VERSION_30, 30 GTALK_PLUGIN_VERSION_30,
30 GTALK_PLUGIN_VERSION_31, 31 GTALK_PLUGIN_VERSION_31,
31 GTALK_PLUGIN_VERSION_32, 32 GTALK_PLUGIN_VERSION_32,
32 GTALK_PLUGIN_VERSION_33, 33 GTALK_PLUGIN_VERSION_33,
33 GTALK_PLUGIN_VERSION_34, 34 GTALK_PLUGIN_VERSION_34,
34 GTALK_PLUGIN_VERSION_MAX 35 GTALK_PLUGIN_VERSION_MAX
35 }; 36 };
36 37
37 // Converts the version string of Google Talk Plugin to a version enum. The 38 // Converts the version string of Google Talk Plugin to a version enum. The
38 // version format is "major(1 digit).minor(1 digit).sub(1 or 2 digits)", 39 // version format is "major(1 digit).minor(1 digit).sub(1 or 2 digits)",
39 // for example, "2.7.10" and "2.8.1". Converts the string to a number as 40 // for example, "2.7.10" and "2.8.1". Converts the string to a number as
40 // 10 * major + minor - kGTalkPluginLogMinVersion. 41 // 10 * major + minor - kGTalkPluginLogMinVersion.
41 GTalkPluginLogVersion GetGTalkPluginVersion(const string16& version) { 42 GTalkPluginLogVersion GetGTalkPluginVersion(const string16& version) {
42 int gtalk_plugin_version = GTALK_PLUGIN_VERSION_MIN; 43 int gtalk_plugin_version = GTALK_PLUGIN_VERSION_MIN;
43 Version plugin_version; 44 Version plugin_version;
44 webkit::npapi::PluginGroup::CreateVersionFromString(version, &plugin_version); 45 webkit::WebPluginInfo::CreateVersionFromString(version, &plugin_version);
45 if (plugin_version.IsValid() && plugin_version.components().size() >= 2) { 46 if (plugin_version.IsValid() && plugin_version.components().size() >= 2) {
46 gtalk_plugin_version = 10 * plugin_version.components()[0] + 47 gtalk_plugin_version = 10 * plugin_version.components()[0] +
47 plugin_version.components()[1] - kGTalkPluginLogMinVersion; 48 plugin_version.components()[1] - kGTalkPluginLogMinVersion;
48 } 49 }
49 50
50 if (gtalk_plugin_version < GTALK_PLUGIN_VERSION_MIN) 51 if (gtalk_plugin_version < GTALK_PLUGIN_VERSION_MIN)
51 return GTALK_PLUGIN_VERSION_MIN; 52 return GTALK_PLUGIN_VERSION_MIN;
52 if (gtalk_plugin_version > GTALK_PLUGIN_VERSION_MAX) 53 if (gtalk_plugin_version > GTALK_PLUGIN_VERSION_MAX)
53 return GTALK_PLUGIN_VERSION_MAX; 54 return GTALK_PLUGIN_VERSION_MAX;
54 return static_cast<GTalkPluginLogVersion>(gtalk_plugin_version); 55 return static_cast<GTalkPluginLogVersion>(gtalk_plugin_version);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 void CALLBACK HungPluginAction::HungWindowResponseCallback(HWND target_window, 203 void CALLBACK HungPluginAction::HungWindowResponseCallback(HWND target_window,
203 UINT message, 204 UINT message,
204 ULONG_PTR data, 205 ULONG_PTR data,
205 LRESULT result) { 206 LRESULT result) {
206 HungPluginAction* instance = reinterpret_cast<HungPluginAction*>(data); 207 HungPluginAction* instance = reinterpret_cast<HungPluginAction*>(data);
207 DCHECK(NULL != instance); 208 DCHECK(NULL != instance);
208 if (NULL != instance) { 209 if (NULL != instance) {
209 instance->OnWindowResponsive(target_window); 210 instance->OnWindowResponsive(target_window);
210 } 211 }
211 } 212 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/plugin_finder.h » ('j') | chrome/browser/plugin_finder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698