| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/webstore_install_with_prompt.h" | 5 #include "chrome/browser/extensions/webstore_install_with_prompt.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/webstore_installer.h" | 7 #include "chrome/browser/extensions/webstore_installer.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 10 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 | 12 |
| 13 using content::WebContents; | 13 using content::WebContents; |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 | 16 |
| 17 WebstoreInstallWithPrompt::WebstoreInstallWithPrompt( | 17 WebstoreInstallWithPrompt::WebstoreInstallWithPrompt( |
| 18 const std::string& webstore_item_id, | 18 const std::string& webstore_item_id, |
| 19 Profile* profile, | 19 Profile* profile, |
| 20 const Callback& callback) | 20 const Callback& callback) |
| 21 : WebstoreStandaloneInstaller(webstore_item_id, profile, callback), | 21 : WebstoreStandaloneInstaller(webstore_item_id, profile, callback), |
| 22 show_post_install_ui_(true), |
| 22 dummy_web_contents_( | 23 dummy_web_contents_( |
| 23 WebContents::Create(WebContents::CreateParams(profile))), | 24 WebContents::Create(WebContents::CreateParams(profile))), |
| 24 parent_window_(NULL) { | 25 parent_window_(NULL) { |
| 25 set_install_source(WebstoreInstaller::INSTALL_SOURCE_OTHER); | 26 set_install_source(WebstoreInstaller::INSTALL_SOURCE_OTHER); |
| 26 } | 27 } |
| 27 | 28 |
| 28 WebstoreInstallWithPrompt::WebstoreInstallWithPrompt( | 29 WebstoreInstallWithPrompt::WebstoreInstallWithPrompt( |
| 29 const std::string& webstore_item_id, | 30 const std::string& webstore_item_id, |
| 30 Profile* profile, | 31 Profile* profile, |
| 31 gfx::NativeWindow parent_window, | 32 gfx::NativeWindow parent_window, |
| 32 const Callback& callback) | 33 const Callback& callback) |
| 33 : WebstoreStandaloneInstaller(webstore_item_id, profile, callback), | 34 : WebstoreStandaloneInstaller(webstore_item_id, profile, callback), |
| 35 show_post_install_ui_(true), |
| 34 dummy_web_contents_( | 36 dummy_web_contents_( |
| 35 WebContents::Create(WebContents::CreateParams(profile))), | 37 WebContents::Create(WebContents::CreateParams(profile))), |
| 36 parent_window_(parent_window) { | 38 parent_window_(parent_window) { |
| 37 DCHECK(parent_window); | 39 DCHECK(parent_window); |
| 38 set_install_source(WebstoreInstaller::INSTALL_SOURCE_OTHER); | 40 set_install_source(WebstoreInstaller::INSTALL_SOURCE_OTHER); |
| 39 } | 41 } |
| 40 | 42 |
| 41 WebstoreInstallWithPrompt::~WebstoreInstallWithPrompt() { | 43 WebstoreInstallWithPrompt::~WebstoreInstallWithPrompt() { |
| 42 } | 44 } |
| 43 | 45 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 58 | 60 |
| 59 scoped_ptr<ExtensionInstallPrompt> | 61 scoped_ptr<ExtensionInstallPrompt> |
| 60 WebstoreInstallWithPrompt::CreateInstallUI() { | 62 WebstoreInstallWithPrompt::CreateInstallUI() { |
| 61 // Create an ExtensionInstallPrompt. If the parent window is NULL, the dialog | 63 // Create an ExtensionInstallPrompt. If the parent window is NULL, the dialog |
| 62 // will be placed in the middle of the screen. | 64 // will be placed in the middle of the screen. |
| 63 return make_scoped_ptr( | 65 return make_scoped_ptr( |
| 64 new ExtensionInstallPrompt(profile(), parent_window_, this)); | 66 new ExtensionInstallPrompt(profile(), parent_window_, this)); |
| 65 } | 67 } |
| 66 | 68 |
| 67 bool WebstoreInstallWithPrompt::ShouldShowPostInstallUI() const { | 69 bool WebstoreInstallWithPrompt::ShouldShowPostInstallUI() const { |
| 68 return false; | 70 return show_post_install_ui_; |
| 69 } | 71 } |
| 70 | 72 |
| 71 bool WebstoreInstallWithPrompt::ShouldShowAppInstalledBubble() const { | 73 bool WebstoreInstallWithPrompt::ShouldShowAppInstalledBubble() const { |
| 72 return false; | 74 return false; |
| 73 } | 75 } |
| 74 | 76 |
| 75 WebContents* WebstoreInstallWithPrompt::GetWebContents() const { | 77 WebContents* WebstoreInstallWithPrompt::GetWebContents() const { |
| 76 return dummy_web_contents_.get(); | 78 return dummy_web_contents_.get(); |
| 77 } | 79 } |
| 78 | 80 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 93 } | 95 } |
| 94 | 96 |
| 95 content::WebContents* WebstoreInstallWithPrompt::OpenURL( | 97 content::WebContents* WebstoreInstallWithPrompt::OpenURL( |
| 96 const content::OpenURLParams& params) { | 98 const content::OpenURLParams& params) { |
| 97 chrome::ScopedTabbedBrowserDisplayer displayer(profile(), | 99 chrome::ScopedTabbedBrowserDisplayer displayer(profile(), |
| 98 chrome::GetActiveDesktop()); | 100 chrome::GetActiveDesktop()); |
| 99 return displayer.browser()->OpenURL(params); | 101 return displayer.browser()->OpenURL(params); |
| 100 } | 102 } |
| 101 | 103 |
| 102 } // namespace extensions | 104 } // namespace extensions |
| OLD | NEW |