OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/l10n_util.h" | 5 #include "app/l10n_util.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/rand_util.h" | 7 #include "base/rand_util.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/browser_list.h" | 9 #include "chrome/browser/browser_list.h" |
10 #include "chrome/browser/browser_window.h" | 10 #include "chrome/browser/browser_window.h" |
11 #include "chrome/browser/extensions/extension_install_ui.h" | 11 #include "chrome/browser/extensions/extension_install_ui.h" |
12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
14 #include "views/controls/image_view.h" | 14 #include "views/controls/image_view.h" |
15 #include "views/controls/label.h" | 15 #include "views/controls/label.h" |
16 #include "views/controls/link.h" | 16 #include "views/controls/link.h" |
17 #include "views/standard_layout.h" | 17 #include "views/standard_layout.h" |
18 #include "views/view.h" | 18 #include "views/view.h" |
19 #include "views/window/dialog_delegate.h" | 19 #include "views/window/dialog_delegate.h" |
20 #include "views/window/window.h" | 20 #include "views/window/window.h" |
21 | 21 |
| 22 #if defined(OS_WIN) |
| 23 #include "app/win_util.h" |
| 24 #endif |
| 25 |
22 class Profile; | 26 class Profile; |
23 | 27 |
24 namespace { | 28 namespace { |
25 | 29 |
26 const int kRightColumnWidth = 270; | 30 const int kRightColumnWidth = 270; |
27 const int kIconSize = 85; | 31 const int kIconSize = 85; |
28 | 32 |
29 // Implements the extension installation prompt for Windows. | 33 // Implements the extension installation prompt for Windows. |
30 class InstallDialogContent : public views::View, public views::DialogDelegate { | 34 class InstallDialogContent : public views::View, public views::DialogDelegate { |
31 public: | 35 public: |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 131 } |
128 | 132 |
129 ExtensionInstallUI::Delegate* delegate_; | 133 ExtensionInstallUI::Delegate* delegate_; |
130 views::ImageView* icon_; | 134 views::ImageView* icon_; |
131 views::Label* heading_; | 135 views::Label* heading_; |
132 views::Label* warning_; | 136 views::Label* warning_; |
133 | 137 |
134 DISALLOW_COPY_AND_ASSIGN(InstallDialogContent); | 138 DISALLOW_COPY_AND_ASSIGN(InstallDialogContent); |
135 }; | 139 }; |
136 | 140 |
137 } // namespace | 141 } // namespace |
138 | 142 |
139 void ExtensionInstallUI::ShowExtensionInstallPrompt( | 143 void ExtensionInstallUI::ShowExtensionInstallPrompt( |
140 Profile* profile, Delegate* delegate, Extension* extension, SkBitmap* icon, | 144 Profile* profile, Delegate* delegate, Extension* extension, SkBitmap* icon, |
141 const std::wstring& warning_text) { | 145 const std::wstring& warning_text) { |
142 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); | 146 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); |
143 if (!browser) { | 147 if (!browser) { |
144 delegate->ContinueInstall(); | 148 delegate->ContinueInstall(); |
145 return; | 149 return; |
146 } | 150 } |
147 | 151 |
148 BrowserWindow* window = browser->window(); | 152 BrowserWindow* window = browser->window(); |
149 if (!window) { | 153 if (!window) { |
150 delegate->AbortInstall(); | 154 delegate->AbortInstall(); |
151 return; | 155 return; |
152 } | 156 } |
153 | 157 |
154 views::Window::CreateChromeWindow(window->GetNativeHandle(), gfx::Rect(), | 158 views::Window::CreateChromeWindow(window->GetNativeHandle(), gfx::Rect(), |
155 new InstallDialogContent(delegate, extension, icon, | 159 new InstallDialogContent(delegate, extension, icon, |
156 warning_text))->Show(); | 160 warning_text))->Show(); |
157 } | 161 } |
| 162 |
| 163 void ExtensionInstallUI::ShowExtensionInstallError(const std::string& error) { |
| 164 #if defined(OS_WIN) |
| 165 win_util::MessageBox(NULL, UTF8ToWide(error), |
| 166 l10n_util::GetString(IDS_EXTENSION_INSTALL_FAILURE_TITLE), |
| 167 MB_OK | MB_SETFOREGROUND); |
| 168 #else |
| 169 // TODO(port): Port this over to OS_* |
| 170 NOTREACHED(); |
| 171 #endif |
| 172 } |
OLD | NEW |