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/extensions/extension_install_prompt.h" | 5 #include "chrome/browser/extensions/extension_install_prompt.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "ui/base/l10n/l10n_util.h" | 33 #include "ui/base/l10n/l10n_util.h" |
34 #include "ui/base/resource/resource_bundle.h" | 34 #include "ui/base/resource/resource_bundle.h" |
35 #include "ui/gfx/image/image.h" | 35 #include "ui/gfx/image/image.h" |
36 | 36 |
37 #if defined(USE_ASH) | 37 #if defined(USE_ASH) |
38 #include "ash/shell.h" | 38 #include "ash/shell.h" |
39 #endif | 39 #endif |
40 | 40 |
41 using extensions::BundleInstaller; | 41 using extensions::BundleInstaller; |
42 using extensions::Extension; | 42 using extensions::Extension; |
| 43 using extensions::PermissionSet; |
43 | 44 |
44 static const int kTitleIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { | 45 static const int kTitleIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { |
45 0, // The regular install prompt depends on what's being installed. | 46 0, // The regular install prompt depends on what's being installed. |
46 IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE, | 47 IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE, |
47 IDS_EXTENSION_INSTALL_PROMPT_TITLE, | 48 IDS_EXTENSION_INSTALL_PROMPT_TITLE, |
48 IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE, | 49 IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE, |
49 IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE | 50 IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE |
50 }; | 51 }; |
51 static const int kHeadingIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { | 52 static const int kHeadingIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { |
52 IDS_EXTENSION_INSTALL_PROMPT_HEADING, | 53 IDS_EXTENSION_INSTALL_PROMPT_HEADING, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 prompt_(UNSET_PROMPT_TYPE), | 248 prompt_(UNSET_PROMPT_TYPE), |
248 prompt_type_(UNSET_PROMPT_TYPE), | 249 prompt_type_(UNSET_PROMPT_TYPE), |
249 ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) { | 250 ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) { |
250 } | 251 } |
251 | 252 |
252 ExtensionInstallPrompt::~ExtensionInstallPrompt() { | 253 ExtensionInstallPrompt::~ExtensionInstallPrompt() { |
253 } | 254 } |
254 | 255 |
255 void ExtensionInstallPrompt::ConfirmBundleInstall( | 256 void ExtensionInstallPrompt::ConfirmBundleInstall( |
256 extensions::BundleInstaller* bundle, | 257 extensions::BundleInstaller* bundle, |
257 const ExtensionPermissionSet* permissions) { | 258 const PermissionSet* permissions) { |
258 DCHECK(ui_loop_ == MessageLoop::current()); | 259 DCHECK(ui_loop_ == MessageLoop::current()); |
259 bundle_ = bundle; | 260 bundle_ = bundle; |
260 permissions_ = permissions; | 261 permissions_ = permissions; |
261 delegate_ = bundle; | 262 delegate_ = bundle; |
262 prompt_type_ = BUNDLE_INSTALL_PROMPT; | 263 prompt_type_ = BUNDLE_INSTALL_PROMPT; |
263 | 264 |
264 ShowConfirmation(); | 265 ShowConfirmation(); |
265 } | 266 } |
266 | 267 |
267 void ExtensionInstallPrompt::ConfirmInlineInstall( | 268 void ExtensionInstallPrompt::ConfirmInlineInstall( |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 permissions_ = extension->GetActivePermissions(); | 324 permissions_ = extension->GetActivePermissions(); |
324 delegate_ = delegate; | 325 delegate_ = delegate; |
325 prompt_type_ = RE_ENABLE_PROMPT; | 326 prompt_type_ = RE_ENABLE_PROMPT; |
326 | 327 |
327 LoadImageIfNeeded(); | 328 LoadImageIfNeeded(); |
328 } | 329 } |
329 | 330 |
330 void ExtensionInstallPrompt::ConfirmPermissions( | 331 void ExtensionInstallPrompt::ConfirmPermissions( |
331 Delegate* delegate, | 332 Delegate* delegate, |
332 const Extension* extension, | 333 const Extension* extension, |
333 const ExtensionPermissionSet* permissions) { | 334 const PermissionSet* permissions) { |
334 DCHECK(ui_loop_ == MessageLoop::current()); | 335 DCHECK(ui_loop_ == MessageLoop::current()); |
335 extension_ = extension; | 336 extension_ = extension; |
336 permissions_ = permissions; | 337 permissions_ = permissions; |
337 delegate_ = delegate; | 338 delegate_ = delegate; |
338 prompt_type_ = PERMISSIONS_PROMPT; | 339 prompt_type_ = PERMISSIONS_PROMPT; |
339 | 340 |
340 LoadImageIfNeeded(); | 341 LoadImageIfNeeded(); |
341 } | 342 } |
342 | 343 |
343 void ExtensionInstallPrompt::OnInstallSuccess(const Extension* extension, | 344 void ExtensionInstallPrompt::OnInstallSuccess(const Extension* extension, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 case BUNDLE_INSTALL_PROMPT: { | 402 case BUNDLE_INSTALL_PROMPT: { |
402 prompt_.set_bundle(bundle_); | 403 prompt_.set_bundle(bundle_); |
403 ShowExtensionInstallDialog(browser_, delegate_, prompt_); | 404 ShowExtensionInstallDialog(browser_, delegate_, prompt_); |
404 break; | 405 break; |
405 } | 406 } |
406 default: | 407 default: |
407 NOTREACHED() << "Unknown message"; | 408 NOTREACHED() << "Unknown message"; |
408 break; | 409 break; |
409 } | 410 } |
410 } | 411 } |
OLD | NEW |