Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2572)

Unified Diff: chrome/browser/chromeos/extensions/file_manager/file_manager_installer.cc

Issue 23332012: Add a private API method to install a webstore app from Files.app (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use lastError and lasteError.message on error. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/file_manager/file_manager_installer.cc
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_manager_installer.cc b/chrome/browser/chromeos/extensions/file_manager/file_manager_installer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..afe6e751ce9de8e880b2c8b020375fccba07c86c
--- /dev/null
+++ b/chrome/browser/chromeos/extensions/file_manager/file_manager_installer.cc
@@ -0,0 +1,88 @@
+// 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/file_manager_installer.h"
+
+#include "base/strings/stringprintf.h"
+#include "chrome/browser/profiles/profile.h"
+#include "content/public/browser/web_contents.h"
+
+using content::WebContents;
hashimoto 2013/08/30 09:09:37 nit: No need to have this 'using' statement? Most
yoshiki 2013/08/30 09:51:46 Removed.
+
+namespace file_manager {
+
+const char kWebContentsDestroyedError[] = "WebContents is destroyed.";
hashimoto 2013/08/30 09:09:37 This should be in an unnamed namespace.
yoshiki 2013/08/30 09:51:46 Done.
+
+FileManagerInstaller::FileManagerInstaller(
+ content::WebContents* web_contents,
+ const std::string& webstore_item_id,
+ Profile* profile,
+ const Callback& callback)
+ : extensions::WebstoreStandaloneInstaller(
+ webstore_item_id,
+ profile,
+ callback),
+ content::WebContentsObserver(web_contents),
+ callback_(callback) {
+}
+
+FileManagerInstaller::~FileManagerInstaller() {}
+
+bool FileManagerInstaller::CheckRequestorAlive() const {
+ // The tab may have gone away - cancel installation in that case.
+ return web_contents() != NULL;
+}
+
+const GURL& FileManagerInstaller::GetRequestorURL() const {
+ return dummy_url_;
+}
+
+scoped_ptr<ExtensionInstallPrompt::Prompt>
+FileManagerInstaller::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 FileManagerInstaller::ShouldShowPostInstallUI() const {
+ return false;
+}
+
+bool FileManagerInstaller::ShouldShowAppInstalledBubble() const {
+ return false;
+}
+
+WebContents* FileManagerInstaller::GetWebContents() const {
+ return web_contents();
+}
+
+bool FileManagerInstaller::CheckInlineInstallPermitted(
+ const base::DictionaryValue& webstore_data,
+ std::string* error) const {
+ DCHECK(error != NULL);
+ DCHECK(error->empty());
+ return true;
+}
+
+bool FileManagerInstaller::CheckRequestorPermitted(
+ const base::DictionaryValue& webstore_data,
+ std::string* error) const {
+ DCHECK(error != NULL);
+ DCHECK(error->empty());
+ return true;
+}
+
+void FileManagerInstaller::WebContentsDestroyed(
+ content::WebContents* web_contents) {
+ callback_.Run(false, kWebContentsDestroyedError);
+ AbortInstall();
+}
+
+} // namespace file_manager

Powered by Google App Engine
This is Rietveld 408576698