Index: chrome/browser/chromeos/extensions/file_manager/webstore_app_installer.cc |
diff --git a/chrome/browser/chromeos/extensions/file_manager/webstore_app_installer.cc b/chrome/browser/chromeos/extensions/file_manager/webstore_app_installer.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7cdf8d2d9fb141b85fd188c5155bccc53e9cc081 |
--- /dev/null |
+++ b/chrome/browser/chromeos/extensions/file_manager/webstore_app_installer.cc |
@@ -0,0 +1,90 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/chromeos/extensions/file_manager/webstore_app_installer.h" |
+ |
+#include "base/strings/stringprintf.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "content/public/browser/web_contents.h" |
+ |
+using content::WebContents; |
+ |
+namespace file_manager { |
+ |
+const char kWebContentsDestroyedError[] = "WebContents is destroyed."; |
+ |
+WebstoreAppInstaller::WebstoreAppInstaller( |
+ content::WebContents* web_contents, |
+ const std::string& webstore_item_id, |
+ Profile* profile, |
+ const Callback& callback) |
+ : extensions::WebstoreStandaloneInstaller( |
asargent_no_longer_on_chrome
2013/08/27 18:22:33
nit: I think the ":" is supposed to go at the end
yoshiki
2013/08/28 13:19:04
No. According to the style guide, we hasve to put
asargent_no_longer_on_chrome
2013/08/29 22:26:03
Ok, sorry for my mistake, and thanks for double-ch
|
+ webstore_item_id, |
+ profile, |
+ callback), |
+ content::WebContentsObserver(web_contents), |
+ callback_(callback) { |
+} |
+ |
+WebstoreAppInstaller::~WebstoreAppInstaller() {} |
+ |
+bool WebstoreAppInstaller::CheckRequestorAlive() const { |
+ // The tab may have gone away - cancel installation in that case. |
+ return web_contents() != NULL; |
+} |
+ |
+const GURL& WebstoreAppInstaller::GetRequestorURL() const { |
+ return dummy_url_; |
asargent_no_longer_on_chrome
2013/08/27 18:22:33
Ok, I see now why you need dummy_url_. This is sor
yoshiki
2013/08/28 13:19:04
I agree, this method should return just GURL.
|
+} |
+ |
+scoped_ptr<ExtensionInstallPrompt::Prompt> |
+WebstoreAppInstaller::CreateInstallPrompt() const { |
+ scoped_ptr<ExtensionInstallPrompt::Prompt> prompt( |
+ new ExtensionInstallPrompt::Prompt( |
+ ExtensionInstallPrompt::INLINE_INSTALL_PROMPT)); |
+ |
+ prompt->SetInlineInstallWebstoreData(localized_user_count(), |
+ show_user_count(), |
+ average_rating(), |
+ rating_count()); |
+ return prompt.Pass(); |
+} |
+ |
+bool WebstoreAppInstaller::ShouldShowPostInstallUI() const { |
+ return false; |
+} |
+ |
+bool WebstoreAppInstaller::ShouldShowAppInstalledBubble() const { |
+ return false; |
+} |
+ |
+WebContents* WebstoreAppInstaller::GetWebContents() const { |
+ return web_contents(); |
+} |
+ |
+bool WebstoreAppInstaller::CheckInlineInstallPermitted( |
+ const base::DictionaryValue& webstore_data, |
+ std::string* error) const { |
+ error->clear(); |
asargent_no_longer_on_chrome
2013/08/27 18:22:33
nit: I'd personally rather just leave |error| alon
yoshiki
2013/08/28 13:19:04
Done.
|
+ return true; |
+} |
+ |
+bool WebstoreAppInstaller::CheckRequestorPermitted( |
+ const base::DictionaryValue& webstore_data, |
+ std::string* error) const { |
+ error->clear(); |
asargent_no_longer_on_chrome
2013/08/27 18:22:33
same here
yoshiki
2013/08/28 13:19:04
Done.
|
+ return true; |
+} |
+ |
+// |
+// Private implementation. |
asargent_no_longer_on_chrome
2013/08/27 18:22:33
I'm not sure this comment really helps any with re
yoshiki
2013/08/28 13:19:04
Removed
|
+// |
+ |
+void WebstoreAppInstaller::WebContentsDestroyed( |
+ content::WebContents* web_contents) { |
+ callback_.Run(false, kWebContentsDestroyedError); |
+ AbortInstall(); |
+} |
+ |
+} // namespace file_manager |