OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/default_plugin/plugin_impl_mac.h" | 5 #include "chrome/default_plugin/plugin_impl_mac.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "chrome/default_plugin/plugin_main.h" | 12 #include "chrome/default_plugin/plugin_main.h" |
13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
14 #include "grit/default_plugin_resources.h" | 14 #include "grit/default_plugin_resources.h" |
15 #include "grit/webkit_strings.h" | 15 #include "grit/webkit_strings.h" |
16 #include "ui/base/l10n/l10n_util_mac.h" | 16 #include "ui/base/l10n/l10n_util_mac.h" |
17 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 18 #include "ui/gfx/image.h" |
18 #include "unicode/locid.h" | 19 #include "unicode/locid.h" |
19 #include "webkit/glue/webkit_glue.h" | 20 #include "webkit/glue/webkit_glue.h" |
20 #include "webkit/plugins/npapi/default_plugin_shared.h" | 21 #include "webkit/plugins/npapi/default_plugin_shared.h" |
21 | 22 |
22 // TODO(thakis): Most methods in this class are stubbed out and need to be | 23 // TODO(thakis): Most methods in this class are stubbed out and need to be |
23 // implemented. | 24 // implemented. |
24 | 25 |
25 PluginInstallerImpl::PluginInstallerImpl(int16 mode) | 26 PluginInstallerImpl::PluginInstallerImpl(int16 mode) |
26 : image_(nil), | 27 : image_(nil), |
27 command_(nil) { | 28 command_(nil) { |
28 } | 29 } |
29 | 30 |
30 PluginInstallerImpl::~PluginInstallerImpl() { | 31 PluginInstallerImpl::~PluginInstallerImpl() { |
31 [image_ release]; | |
32 [command_ release]; | 32 [command_ release]; |
33 } | 33 } |
34 | 34 |
35 bool PluginInstallerImpl::Initialize(void* module_handle, NPP instance, | 35 bool PluginInstallerImpl::Initialize(void* module_handle, NPP instance, |
36 NPMIMEType mime_type, int16 argc, | 36 NPMIMEType mime_type, int16 argc, |
37 char* argn[], char* argv[]) { | 37 char* argn[], char* argv[]) { |
38 DVLOG(1) << __FUNCTION__ << " MIME Type : " << mime_type; | 38 DVLOG(1) << __FUNCTION__ << " MIME Type : " << mime_type; |
39 DCHECK(instance != NULL); | 39 DCHECK(instance != NULL); |
40 | 40 |
41 if (mime_type == NULL || strlen(mime_type) == 0) { | 41 if (mime_type == NULL || strlen(mime_type) == 0) { |
42 DLOG(WARNING) << __FUNCTION__ << " Invalid parameters passed in"; | 42 DLOG(WARNING) << __FUNCTION__ << " Invalid parameters passed in"; |
43 NOTREACHED(); | 43 NOTREACHED(); |
44 return false; | 44 return false; |
45 } | 45 } |
46 | 46 |
47 instance_ = instance; | 47 instance_ = instance; |
48 mime_type_ = mime_type; | 48 mime_type_ = mime_type; |
49 | 49 |
50 command_ = [l10n_util::FixUpWindowsStyleLabel(webkit_glue::GetLocalizedString( | 50 command_ = [l10n_util::FixUpWindowsStyleLabel(webkit_glue::GetLocalizedString( |
51 IDS_DEFAULT_PLUGIN_NO_PLUGIN_AVAILABLE_MSG)) retain]; | 51 IDS_DEFAULT_PLUGIN_NO_PLUGIN_AVAILABLE_MSG)) retain]; |
52 | 52 |
53 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 53 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
54 image_ = [rb.GetNativeImageNamed(IDR_PLUGIN_ICON) retain]; | 54 image_ = rb.GetNativeImageNamed(IDR_PLUGIN_ICON); |
55 | 55 |
56 return true; | 56 return true; |
57 } | 57 } |
58 | 58 |
59 bool PluginInstallerImpl::NPP_SetWindow(NPWindow* window_info) { | 59 bool PluginInstallerImpl::NPP_SetWindow(NPWindow* window_info) { |
60 width_ = window_info->width; | 60 width_ = window_info->width; |
61 height_ = window_info->height; | 61 height_ = window_info->height; |
62 return true; | 62 return true; |
63 } | 63 } |
64 | 64 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 void PluginInstallerImpl::ShowInstallDialog() { | 190 void PluginInstallerImpl::ShowInstallDialog() { |
191 } | 191 } |
192 | 192 |
193 void PluginInstallerImpl::NotifyPluginStatus(int status) { | 193 void PluginInstallerImpl::NotifyPluginStatus(int status) { |
194 default_plugin::g_browser->getvalue( | 194 default_plugin::g_browser->getvalue( |
195 instance_, | 195 instance_, |
196 static_cast<NPNVariable>( | 196 static_cast<NPNVariable>( |
197 webkit::npapi::default_plugin::kMissingPluginStatusStart + status), | 197 webkit::npapi::default_plugin::kMissingPluginStatusStart + status), |
198 NULL); | 198 NULL); |
199 } | 199 } |
OLD | NEW |