OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/chromeos/extensions/file_manager/webstore_app_installer .h" | |
6 | |
7 #include "base/strings/stringprintf.h" | |
8 #include "chrome/browser/profiles/profile.h" | |
9 #include "content/public/browser/web_contents.h" | |
10 | |
11 using content::WebContents; | |
12 | |
13 namespace file_manager { | |
14 | |
15 const char kWebContentsDestroyedError[] = "WebContents is destroyed."; | |
16 | |
17 WebstoreAppInstaller::WebstoreAppInstaller( | |
18 content::WebContents* web_contents, | |
19 const std::string& webstore_item_id, | |
20 Profile* profile, | |
21 const Callback& callback) | |
22 : 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
| |
23 webstore_item_id, | |
24 profile, | |
25 callback), | |
26 content::WebContentsObserver(web_contents), | |
27 callback_(callback) { | |
28 } | |
29 | |
30 WebstoreAppInstaller::~WebstoreAppInstaller() {} | |
31 | |
32 bool WebstoreAppInstaller::CheckRequestorAlive() const { | |
33 // The tab may have gone away - cancel installation in that case. | |
34 return web_contents() != NULL; | |
35 } | |
36 | |
37 const GURL& WebstoreAppInstaller::GetRequestorURL() const { | |
38 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.
| |
39 } | |
40 | |
41 scoped_ptr<ExtensionInstallPrompt::Prompt> | |
42 WebstoreAppInstaller::CreateInstallPrompt() const { | |
43 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt( | |
44 new ExtensionInstallPrompt::Prompt( | |
45 ExtensionInstallPrompt::INLINE_INSTALL_PROMPT)); | |
46 | |
47 prompt->SetInlineInstallWebstoreData(localized_user_count(), | |
48 show_user_count(), | |
49 average_rating(), | |
50 rating_count()); | |
51 return prompt.Pass(); | |
52 } | |
53 | |
54 bool WebstoreAppInstaller::ShouldShowPostInstallUI() const { | |
55 return false; | |
56 } | |
57 | |
58 bool WebstoreAppInstaller::ShouldShowAppInstalledBubble() const { | |
59 return false; | |
60 } | |
61 | |
62 WebContents* WebstoreAppInstaller::GetWebContents() const { | |
63 return web_contents(); | |
64 } | |
65 | |
66 bool WebstoreAppInstaller::CheckInlineInstallPermitted( | |
67 const base::DictionaryValue& webstore_data, | |
68 std::string* error) const { | |
69 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.
| |
70 return true; | |
71 } | |
72 | |
73 bool WebstoreAppInstaller::CheckRequestorPermitted( | |
74 const base::DictionaryValue& webstore_data, | |
75 std::string* error) const { | |
76 error->clear(); | |
asargent_no_longer_on_chrome
2013/08/27 18:22:33
same here
yoshiki
2013/08/28 13:19:04
Done.
| |
77 return true; | |
78 } | |
79 | |
80 // | |
81 // 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
| |
82 // | |
83 | |
84 void WebstoreAppInstaller::WebContentsDestroyed( | |
85 content::WebContents* web_contents) { | |
86 callback_.Run(false, kWebContentsDestroyedError); | |
87 AbortInstall(); | |
88 } | |
89 | |
90 } // namespace file_manager | |
OLD | NEW |