OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/app_list/search/webstore/webstore_result.h" | 5 #include "chrome/browser/ui/app_list/search/webstore/webstore_result.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/extensions/install_tracker.h" | 13 #include "chrome/browser/extensions/install_tracker.h" |
14 #include "chrome/browser/extensions/install_tracker_factory.h" | 14 #include "chrome/browser/extensions/install_tracker_factory.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 16 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
17 #include "chrome/browser/ui/app_list/search/common/url_icon_source.h" | 17 #include "chrome/browser/ui/app_list/search/common/url_icon_source.h" |
18 #include "chrome/browser/ui/app_list/search/search_util.h" | 18 #include "chrome/browser/ui/app_list/search/search_util.h" |
19 #include "chrome/browser/ui/app_list/search/webstore/webstore_installer.h" | 19 #include "chrome/browser/ui/app_list/search/webstore/webstore_installer.h" |
20 #include "chrome/browser/ui/extensions/application_launch.h" | 20 #include "chrome/browser/ui/extensions/application_launch.h" |
21 #include "chrome/grit/chromium_strings.h" | 21 #include "chrome/grit/chromium_strings.h" |
22 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
23 #include "extensions/browser/extension_registry.h" | 23 #include "extensions/browser/extension_registry.h" |
24 #include "extensions/browser/extension_system.h" | 24 #include "extensions/browser/extension_system.h" |
25 #include "extensions/browser/extension_util.h" | |
26 #include "extensions/common/extension.h" | 25 #include "extensions/common/extension.h" |
27 #include "extensions/common/extension_urls.h" | 26 #include "extensions/common/extension_urls.h" |
28 #include "grit/theme_resources.h" | 27 #include "grit/theme_resources.h" |
29 #include "net/base/url_util.h" | 28 #include "net/base/url_util.h" |
30 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
31 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
32 | 31 |
33 namespace app_list { | 32 namespace app_list { |
34 | 33 |
35 WebstoreResult::WebstoreResult(Profile* profile, | 34 WebstoreResult::WebstoreResult(Profile* profile, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 119 |
121 install_tracker_->AddObserver(this); | 120 install_tracker_->AddObserver(this); |
122 extension_registry_->AddObserver(this); | 121 extension_registry_->AddObserver(this); |
123 } | 122 } |
124 | 123 |
125 void WebstoreResult::UpdateActions() { | 124 void WebstoreResult::UpdateActions() { |
126 Actions actions; | 125 Actions actions; |
127 | 126 |
128 const bool is_otr = profile_->IsOffTheRecord(); | 127 const bool is_otr = profile_->IsOffTheRecord(); |
129 const bool is_installed = | 128 const bool is_installed = |
130 extensions::util::IsExtensionInstalledPermanently(app_id_, profile_); | 129 extension_registry_->GetExtensionById( |
| 130 app_id_, extensions::ExtensionRegistry::EVERYTHING) != nullptr; |
131 | 131 |
132 if (!is_otr && !is_installed && !is_installing()) { | 132 if (!is_otr && !is_installed && !is_installing()) { |
133 actions.push_back(Action( | 133 actions.push_back(Action( |
134 l10n_util::GetStringUTF16(IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE), | 134 l10n_util::GetStringUTF16(IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE), |
135 base::string16())); | 135 base::string16())); |
136 } | 136 } |
137 | 137 |
138 SetActions(actions); | 138 SetActions(actions); |
139 } | 139 } |
140 | 140 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 void WebstoreResult::OnExtensionInstalled( | 221 void WebstoreResult::OnExtensionInstalled( |
222 content::BrowserContext* browser_context, | 222 content::BrowserContext* browser_context, |
223 const extensions::Extension* extension, | 223 const extensions::Extension* extension, |
224 bool is_update) { | 224 bool is_update) { |
225 if (extension->id() != app_id_) | 225 if (extension->id() != app_id_) |
226 return; | 226 return; |
227 | 227 |
228 SetIsInstalling(false); | 228 SetIsInstalling(false); |
229 UpdateActions(); | 229 UpdateActions(); |
230 | 230 |
231 if (extensions::util::IsExtensionInstalledPermanently(extension->id(), | 231 if (extension_registry_->GetExtensionById( |
232 profile_)) { | 232 app_id_, extensions::ExtensionRegistry::EVERYTHING)) { |
233 NotifyItemInstalled(); | 233 NotifyItemInstalled(); |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 void WebstoreResult::OnShutdown() { | 237 void WebstoreResult::OnShutdown() { |
238 StopObservingInstall(); | 238 StopObservingInstall(); |
239 } | 239 } |
240 | 240 |
241 void WebstoreResult::OnShutdown(extensions::ExtensionRegistry* registry) { | 241 void WebstoreResult::OnShutdown(extensions::ExtensionRegistry* registry) { |
242 StopObservingRegistry(); | 242 StopObservingRegistry(); |
243 } | 243 } |
244 | 244 |
245 } // namespace app_list | 245 } // namespace app_list |
OLD | NEW |