| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
| 6 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 6 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 7 #include "chrome/browser/extensions/extension_install_prompt.h" | 7 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/tab_helper.h" | 9 #include "chrome/browser/extensions/tab_helper.h" |
| 10 #include "chrome/browser/extensions/webstore_inline_installer.h" | 10 #include "chrome/browser/extensions/webstore_inline_installer.h" |
| 11 #include "chrome/browser/extensions/webstore_inline_installer_factory.h" | 11 #include "chrome/browser/extensions/webstore_inline_installer_factory.h" |
| 12 #include "chrome/browser/extensions/webstore_installer_test.h" | 12 #include "chrome/browser/extensions/webstore_installer_test.h" |
| 13 #include "chrome/browser/extensions/webstore_standalone_installer.h" | 13 #include "chrome/browser/extensions/webstore_standalone_installer.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_finder.h" | 16 #include "chrome/browser/ui/browser_finder.h" |
| 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 18 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
| 19 #include "components/content_settings/core/browser/host_content_settings_map.h" | 19 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 21 #include "content/public/test/browser_test_utils.h" | 21 #include "content/public/test/browser_test_utils.h" |
| 22 #include "extensions/browser/extension_registry.h" | 22 #include "extensions/browser/extension_registry.h" |
| 23 #include "extensions/browser/extension_system.h" | 23 #include "extensions/browser/extension_system.h" |
| 24 #include "extensions/common/permissions/permission_set.h" |
| 24 #include "url/gurl.h" | 25 #include "url/gurl.h" |
| 25 | 26 |
| 26 using content::WebContents; | 27 using content::WebContents; |
| 27 | 28 |
| 28 namespace extensions { | 29 namespace extensions { |
| 29 | 30 |
| 30 namespace { | 31 namespace { |
| 31 | 32 |
| 32 const char kWebstoreDomain[] = "cws.com"; | 33 const char kWebstoreDomain[] = "cws.com"; |
| 33 const char kAppDomain[] = "app.com"; | 34 const char kAppDomain[] = "app.com"; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 class ProgrammableInstallPrompt : public ExtensionInstallPrompt { | 61 class ProgrammableInstallPrompt : public ExtensionInstallPrompt { |
| 61 public: | 62 public: |
| 62 explicit ProgrammableInstallPrompt(WebContents* contents) | 63 explicit ProgrammableInstallPrompt(WebContents* contents) |
| 63 : ExtensionInstallPrompt(contents) | 64 : ExtensionInstallPrompt(contents) |
| 64 {} | 65 {} |
| 65 | 66 |
| 66 ~ProgrammableInstallPrompt() override {} | 67 ~ProgrammableInstallPrompt() override {} |
| 67 | 68 |
| 68 void ShowDialog(Delegate* delegate, | 69 void ShowDialog( |
| 69 const Extension* extension, | 70 Delegate* delegate, |
| 70 const SkBitmap* icon, | 71 const Extension* extension, |
| 71 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt, | 72 const SkBitmap* icon, |
| 72 const ShowDialogCallback& callback) override { | 73 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt, |
| 74 scoped_ptr<const extensions::PermissionSet> custom_permissions, |
| 75 const ShowDialogCallback& callback) override { |
| 73 delegate_ = delegate; | 76 delegate_ = delegate; |
| 74 } | 77 } |
| 75 | 78 |
| 76 static bool Ready() { | 79 static bool Ready() { |
| 77 return delegate_ != NULL; | 80 return delegate_ != NULL; |
| 78 } | 81 } |
| 79 | 82 |
| 80 static void Accept() { | 83 static void Accept() { |
| 81 delegate_->InstallUIProceed(); | 84 delegate_->InstallUIProceed(); |
| 82 } | 85 } |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, | 326 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, |
| 324 DownloadProgressListenerTest) { | 327 DownloadProgressListenerTest) { |
| 325 RunTest("download_progress_listener.html"); | 328 RunTest("download_progress_listener.html"); |
| 326 } | 329 } |
| 327 | 330 |
| 328 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, BothListenersTest) { | 331 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, BothListenersTest) { |
| 329 RunTest("both_listeners.html"); | 332 RunTest("both_listeners.html"); |
| 330 } | 333 } |
| 331 | 334 |
| 332 } // namespace extensions | 335 } // namespace extensions |
| OLD | NEW |