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/app_search_provider.h" | 5 #include "chrome/browser/ui/app_list/search/app_search_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
12 #include "chrome/browser/extensions/extension_system_factory.h" | 12 #include "chrome/browser/extensions/extension_system_factory.h" |
13 #include "chrome/browser/extensions/extension_util.h" | 13 #include "chrome/browser/extensions/extension_util.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/app_list/search/app_result.h" | 15 #include "chrome/browser/ui/app_list/search/app_result.h" |
16 #include "chrome/browser/ui/app_list/search/tokenized_string.h" | 16 #include "chrome/browser/ui/app_list/search/tokenized_string.h" |
17 #include "chrome/browser/ui/app_list/search/tokenized_string_match.h" | 17 #include "chrome/browser/ui/app_list/search/tokenized_string_match.h" |
18 #include "content/public/browser/notification_details.h" | 18 #include "content/public/browser/notification_details.h" |
19 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
| 20 #include "extensions/common/extension.h" |
| 21 #include "extensions/common/extension_set.h" |
20 | 22 |
21 namespace app_list { | 23 namespace app_list { |
22 | 24 |
23 class AppSearchProvider::App { | 25 class AppSearchProvider::App { |
24 public: | 26 public: |
25 explicit App(const extensions::Extension* extension) | 27 explicit App(const extensions::Extension* extension) |
26 : app_id_(extension->id()), | 28 : app_id_(extension->id()), |
27 indexed_name_(UTF8ToUTF16(extension->name())) { | 29 indexed_name_(UTF8ToUTF16(extension->name())) { |
28 } | 30 } |
29 ~App() {} | 31 ~App() {} |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 68 |
67 scoped_ptr<AppResult> result( | 69 scoped_ptr<AppResult> result( |
68 new AppResult(profile_, (*app_it)->app_id(), list_controller_)); | 70 new AppResult(profile_, (*app_it)->app_id(), list_controller_)); |
69 result->UpdateFromMatch((*app_it)->indexed_name(), match); | 71 result->UpdateFromMatch((*app_it)->indexed_name(), match); |
70 Add(result.PassAs<ChromeSearchResult>()); | 72 Add(result.PassAs<ChromeSearchResult>()); |
71 } | 73 } |
72 } | 74 } |
73 | 75 |
74 void AppSearchProvider::Stop() {} | 76 void AppSearchProvider::Stop() {} |
75 | 77 |
76 void AppSearchProvider::AddApps(const ExtensionSet* extensions, | 78 void AppSearchProvider::AddApps(const extensions::ExtensionSet* extensions, |
77 ExtensionService* service) { | 79 ExtensionService* service) { |
78 for (ExtensionSet::const_iterator iter = extensions->begin(); | 80 for (extensions::ExtensionSet::const_iterator iter = extensions->begin(); |
79 iter != extensions->end(); ++iter) { | 81 iter != extensions->end(); ++iter) { |
80 const extensions::Extension* app = iter->get(); | 82 const extensions::Extension* app = iter->get(); |
81 | 83 |
82 if (!app->ShouldDisplayInAppLauncher()) | 84 if (!app->ShouldDisplayInAppLauncher()) |
83 continue; | 85 continue; |
84 | 86 |
85 if (profile_->IsOffTheRecord() && | 87 if (profile_->IsOffTheRecord() && |
86 !extension_util::CanLoadInIncognito(app, service)) | 88 !extension_util::CanLoadInIncognito(app, service)) |
87 continue; | 89 continue; |
88 apps_.push_back(new App(app)); | 90 apps_.push_back(new App(app)); |
(...skipping 14 matching lines...) Expand all Loading... |
103 AddApps(extension_service->terminated_extensions(), extension_service); | 105 AddApps(extension_service->terminated_extensions(), extension_service); |
104 } | 106 } |
105 | 107 |
106 void AppSearchProvider::Observe(int type, | 108 void AppSearchProvider::Observe(int type, |
107 const content::NotificationSource& source, | 109 const content::NotificationSource& source, |
108 const content::NotificationDetails& detaila) { | 110 const content::NotificationDetails& detaila) { |
109 RefreshApps(); | 111 RefreshApps(); |
110 } | 112 } |
111 | 113 |
112 } // namespace app_list | 114 } // namespace app_list |
OLD | NEW |