Chromium Code Reviews| Index: chrome/browser/extensions/webstore_inline_installer.cc |
| diff --git a/chrome/browser/extensions/webstore_inline_installer.cc b/chrome/browser/extensions/webstore_inline_installer.cc |
| index a44d4baa5d2809e9066f5b032dc5f7d915aa26ef..c32d266c776cebfb1b6818b7b05a2f4e33d6a11d 100644 |
| --- a/chrome/browser/extensions/webstore_inline_installer.cc |
| +++ b/chrome/browser/extensions/webstore_inline_installer.cc |
| @@ -6,22 +6,26 @@ |
| #include "base/strings/stringprintf.h" |
| #include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/ui/browser_finder.h" |
| #include "content/public/browser/web_contents.h" |
| using content::WebContents; |
| namespace extensions { |
| -const char kInvalidWebstoreResponseError[] = "Invalid Chrome Web Store reponse"; |
| +const char kInvalidWebstoreResponseError[] = |
| + "Invalid Chrome Web Store response."; |
| const char kNoVerifiedSitesError[] = |
| "Inline installs can only be initiated for Chrome Web Store items that " |
| - "have one or more verified sites"; |
| + "have one or more verified sites."; |
| const char kNotFromVerifiedSitesError[] = |
| "Installs can only be initiated by one of the Chrome Web Store item's " |
| - "verified sites"; |
| + "verified sites."; |
| const char kInlineInstallSupportedError[] = |
| "Inline installation is not supported for this item. The user will be " |
| "redirected to the Chrome Web Store."; |
| +const char kInitiatedFromPopupError[] = |
| + "Inline installs can not be initiated from pop-up windows."; |
| WebstoreInlineInstaller::WebstoreInlineInstaller( |
| content::WebContents* web_contents, |
| @@ -126,6 +130,11 @@ WebContents* WebstoreInlineInstaller::GetWebContents() const { |
| bool WebstoreInlineInstaller::CheckInlineInstallPermitted( |
| const base::DictionaryValue& webstore_data, |
| std::string* error) const { |
| + Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); |
| + if (browser && browser->is_type_popup()) { |
|
Devlin
2015/02/12 17:18:21
Under what circumstances can browser be null? If
meacer
2015/02/12 21:12:05
Not sure if it can ever be null, but if it is I ag
|
| + *error = kInitiatedFromPopupError; |
| + return false; |
| + } |
| // The store may not support inline installs for this item, in which case |
| // we open the store-provided redirect URL in a new tab and abort the |
| // installation process. |
| @@ -151,7 +160,6 @@ bool WebstoreInlineInstaller::CheckInlineInstallPermitted( |
| *error = kInlineInstallSupportedError; |
| return false; |
| } |
| - |
| *error = ""; |
| return true; |
| } |