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 "chrome/browser/extensions/extension_install_prompt.h" | 5 #include "chrome/browser/extensions/extension_install_prompt.h" |
6 #include "chrome/browser/extensions/extension_service.h" | 6 #include "chrome/browser/extensions/extension_service.h" |
7 #include "chrome/browser/extensions/tab_helper.h" | 7 #include "chrome/browser/extensions/tab_helper.h" |
8 #include "chrome/browser/extensions/webstore_inline_installer.h" | 8 #include "chrome/browser/extensions/webstore_inline_installer.h" |
9 #include "chrome/browser/extensions/webstore_inline_installer_factory.h" | 9 #include "chrome/browser/extensions/webstore_inline_installer_factory.h" |
10 #include "chrome/browser/extensions/webstore_installer_test.h" | 10 #include "chrome/browser/extensions/webstore_installer_test.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 kAppDomain, | 42 kAppDomain, |
43 kNonAppDomain) {} | 43 kNonAppDomain) {} |
44 }; | 44 }; |
45 | 45 |
46 class ProgrammableInstallPrompt : public ExtensionInstallPrompt { | 46 class ProgrammableInstallPrompt : public ExtensionInstallPrompt { |
47 public: | 47 public: |
48 explicit ProgrammableInstallPrompt(WebContents* contents) | 48 explicit ProgrammableInstallPrompt(WebContents* contents) |
49 : ExtensionInstallPrompt(contents) | 49 : ExtensionInstallPrompt(contents) |
50 {} | 50 {} |
51 | 51 |
52 virtual ~ProgrammableInstallPrompt() {} | 52 ~ProgrammableInstallPrompt() override {} |
53 | 53 |
54 virtual void ConfirmStandaloneInstall( | 54 void ConfirmStandaloneInstall( |
55 Delegate* delegate, | 55 Delegate* delegate, |
56 const Extension* extension, | 56 const Extension* extension, |
57 SkBitmap* icon, | 57 SkBitmap* icon, |
58 scoped_refptr<ExtensionInstallPrompt::Prompt> prompt) override { | 58 scoped_refptr<ExtensionInstallPrompt::Prompt> prompt) override { |
59 delegate_ = delegate; | 59 delegate_ = delegate; |
60 } | 60 } |
61 | 61 |
62 static bool Ready() { | 62 static bool Ready() { |
63 return delegate_ != NULL; | 63 return delegate_ != NULL; |
64 } | 64 } |
(...skipping 21 matching lines...) Expand all Loading... |
86 const GURL& requestor_url, | 86 const GURL& requestor_url, |
87 const Callback& callback) | 87 const Callback& callback) |
88 : WebstoreInlineInstaller( | 88 : WebstoreInlineInstaller( |
89 contents, | 89 contents, |
90 kTestExtensionId, | 90 kTestExtensionId, |
91 requestor_url, | 91 requestor_url, |
92 base::Bind(DummyCallback)), | 92 base::Bind(DummyCallback)), |
93 programmable_prompt_(NULL) { | 93 programmable_prompt_(NULL) { |
94 } | 94 } |
95 | 95 |
96 virtual scoped_ptr<ExtensionInstallPrompt> CreateInstallUI() override { | 96 scoped_ptr<ExtensionInstallPrompt> CreateInstallUI() override { |
97 programmable_prompt_ = new ProgrammableInstallPrompt(web_contents()); | 97 programmable_prompt_ = new ProgrammableInstallPrompt(web_contents()); |
98 return make_scoped_ptr(programmable_prompt_); | 98 return make_scoped_ptr(programmable_prompt_); |
99 } | 99 } |
100 | 100 |
101 private: | 101 private: |
102 virtual ~WebstoreInlineInstallerForTest() {} | 102 ~WebstoreInlineInstallerForTest() override {} |
103 | 103 |
104 friend class base::RefCountedThreadSafe<WebstoreStandaloneInstaller>; | 104 friend class base::RefCountedThreadSafe<WebstoreStandaloneInstaller>; |
105 | 105 |
106 static void DummyCallback(bool success, | 106 static void DummyCallback(bool success, |
107 const std::string& error, | 107 const std::string& error, |
108 webstore_install::Result result) { | 108 webstore_install::Result result) { |
109 } | 109 } |
110 | 110 |
111 ProgrammableInstallPrompt* programmable_prompt_; | 111 ProgrammableInstallPrompt* programmable_prompt_; |
112 }; | 112 }; |
113 | 113 |
114 class WebstoreInlineInstallerForTestFactory : | 114 class WebstoreInlineInstallerForTestFactory : |
115 public WebstoreInlineInstallerFactory { | 115 public WebstoreInlineInstallerFactory { |
116 virtual ~WebstoreInlineInstallerForTestFactory() {} | 116 ~WebstoreInlineInstallerForTestFactory() override {} |
117 virtual WebstoreInlineInstaller* CreateInstaller( | 117 WebstoreInlineInstaller* CreateInstaller( |
118 WebContents* contents, | 118 WebContents* contents, |
119 const std::string& webstore_item_id, | 119 const std::string& webstore_item_id, |
120 const GURL& requestor_url, | 120 const GURL& requestor_url, |
121 const WebstoreStandaloneInstaller::Callback& callback) override { | 121 const WebstoreStandaloneInstaller::Callback& callback) override { |
122 return new WebstoreInlineInstallerForTest( | 122 return new WebstoreInlineInstallerForTest( |
123 contents, webstore_item_id, requestor_url, callback); | 123 contents, webstore_item_id, requestor_url, callback); |
124 } | 124 } |
125 }; | 125 }; |
126 | 126 |
127 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, | 127 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, | 189 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, |
190 DownloadProgressListenerTest) { | 190 DownloadProgressListenerTest) { |
191 RunTest("download_progress_listener.html"); | 191 RunTest("download_progress_listener.html"); |
192 } | 192 } |
193 | 193 |
194 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, BothListenersTest) { | 194 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, BothListenersTest) { |
195 RunTest("both_listeners.html"); | 195 RunTest("both_listeners.html"); |
196 } | 196 } |
197 | 197 |
198 } // namespace extensions | 198 } // namespace extensions |
OLD | NEW |