OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef WEBKIT_DEFAULT_PLUGIN_INSTALL_DIALOG_H__ | 5 #ifndef CHROME_DEFAULT_PLUGIN_INSTALL_DIALOG_H_ |
6 #define WEBKIT_DEFAULT_PLUGIN_INSTALL_DIALOG_H__ | 6 #define CHROME_DEFAULT_PLUGIN_INSTALL_DIALOG_H_ |
7 | 7 |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlwin.h> | 9 #include <atlwin.h> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "webkit/default_plugin/default_plugin_resources.h" | 13 #include "chrome/default_plugin/default_plugin_resources.h" |
14 | 14 |
15 class PluginInstallerImpl; | 15 class PluginInstallerImpl; |
16 | 16 |
17 // Displays the plugin installation dialog containing information | 17 // Displays the plugin installation dialog containing information |
18 // about the mime type of the plugin being downloaded, the URL | 18 // about the mime type of the plugin being downloaded, the URL |
19 // where it would be downloaded from, etc. | 19 // where it would be downloaded from, etc. |
20 class PluginInstallDialog : public CDialogImpl<PluginInstallDialog> { | 20 class PluginInstallDialog : public CDialogImpl<PluginInstallDialog> { |
21 public: | 21 public: |
22 enum {IDD = IDD_DEFAULT_PLUGIN_INSTALL_DIALOG}; | 22 enum {IDD = IDD_DEFAULT_PLUGIN_INSTALL_DIALOG}; |
23 | 23 |
24 BEGIN_MSG_MAP(PluginInstallDialog) | 24 BEGIN_MSG_MAP(PluginInstallDialog) |
25 MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) | 25 MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) |
26 COMMAND_ID_HANDLER(IDB_GET_THE_PLUGIN, OnGetPlugin) | 26 COMMAND_ID_HANDLER(IDB_GET_THE_PLUGIN, OnGetPlugin) |
27 COMMAND_ID_HANDLER(IDCANCEL, OnCancel) | 27 COMMAND_ID_HANDLER(IDCANCEL, OnCancel) |
28 END_MSG_MAP() | 28 END_MSG_MAP() |
29 | 29 |
30 // Creates or returns the existing object for the given plugin name. | 30 // Creates or returns the existing object for the given plugin name. |
31 // Call RemoveInstaller when done. | 31 // Call RemoveInstaller when done. |
32 static PluginInstallDialog* AddInstaller(PluginInstallerImpl* plugin_impl, | 32 static PluginInstallDialog* AddInstaller(PluginInstallerImpl* plugin_impl, |
33 const std::wstring& plugin_name); | 33 const std::wstring& plugin_name); |
34 | 34 |
35 // Lets this object know that the given installer object is going away. | 35 // Lets this object know that the given installer object is going away. |
36 void RemoveInstaller(PluginInstallerImpl* installer); | 36 void RemoveInstaller(PluginInstallerImpl* installer); |
37 | 37 |
38 void ShowInstallDialog(HWND parent); | 38 void ShowInstallDialog(HWND parent); |
39 | 39 |
40 private: | 40 private: |
41 PluginInstallDialog(const std::wstring& plugin_name); | 41 explicit PluginInstallDialog(const std::wstring& plugin_name); |
42 ~PluginInstallDialog(); | 42 ~PluginInstallDialog(); |
43 | 43 |
44 // Implemented to ensure that we handle RTL layouts correctly. | 44 // Implemented to ensure that we handle RTL layouts correctly. |
45 HWND Create(HWND parent_window, LPARAM init_param); | 45 HWND Create(HWND parent_window, LPARAM init_param); |
46 | 46 |
47 LRESULT OnInitDialog(UINT message, WPARAM wparam, LPARAM lparam, | 47 LRESULT OnInitDialog(UINT message, WPARAM wparam, LPARAM lparam, |
48 BOOL& handled); | 48 BOOL& handled); |
49 LRESULT OnGetPlugin(WORD notify_code, WORD id, HWND wnd_ctl, BOOL &handled); | 49 LRESULT OnGetPlugin(WORD notify_code, WORD id, HWND wnd_ctl, BOOL &handled); |
50 LRESULT OnCancel(WORD notify_code, WORD id, HWND wnd_ctl, BOOL &handled); | 50 LRESULT OnCancel(WORD notify_code, WORD id, HWND wnd_ctl, BOOL &handled); |
51 | 51 |
52 // Wraps the string with Unicode directionality characters in order to make | 52 // Wraps the string with Unicode directionality characters in order to make |
53 // sure BiDi text is rendered correctly when the UI layout is right-to-left. | 53 // sure BiDi text is rendered correctly when the UI layout is right-to-left. |
54 void AdjustTextDirectionality(std::wstring* text) const; | 54 void AdjustTextDirectionality(std::wstring* text) const; |
55 | 55 |
56 std::vector<PluginInstallerImpl*> installers_; | 56 std::vector<PluginInstallerImpl*> installers_; |
57 std::wstring plugin_name_; | 57 std::wstring plugin_name_; |
58 }; | 58 }; |
59 | 59 |
60 #endif // WEBKIT_DEFAULT_PLUGIN_INSTALL_DIALOG_H__ | 60 #endif // CHROME_DEFAULT_PLUGIN_INSTALL_DIALOG_H_ |
OLD | NEW |