Chromium Code Reviews| 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 |