Chromium Code Reviews| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/time/clock.h" | 12 #include "base/time/clock.h" |
| 13 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 14 #include "chrome/browser/extensions/extension_ui_util.h" | 14 #include "chrome/browser/extensions/extension_ui_util.h" |
| 15 #include "chrome/browser/extensions/extension_util.h" | 15 #include "chrome/browser/extensions/extension_util.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/app_list/search/app_result.h" | 17 #include "chrome/browser/ui/app_list/search/app_result.h" |
| 18 #include "extensions/browser/extension_prefs.h" | 18 #include "extensions/browser/extension_prefs.h" |
| 19 #include "extensions/browser/extension_registry.h" | 19 #include "extensions/browser/extension_registry.h" |
| 20 #include "extensions/browser/extension_system.h" | 20 #include "extensions/browser/extension_system.h" |
| 21 #include "extensions/common/extension.h" | 21 #include "extensions/common/extension.h" |
| 22 #include "extensions/common/extension_set.h" | 22 #include "extensions/common/extension_set.h" |
| 23 #include "ui/app_list/app_list_switches.h" | |
| 23 #include "ui/app_list/search/tokenized_string.h" | 24 #include "ui/app_list/search/tokenized_string.h" |
| 24 #include "ui/app_list/search/tokenized_string_match.h" | 25 #include "ui/app_list/search/tokenized_string_match.h" |
| 25 | 26 |
| 26 using extensions::ExtensionRegistry; | 27 using extensions::ExtensionRegistry; |
| 27 | 28 |
| 28 namespace app_list { | 29 namespace app_list { |
| 29 | 30 |
| 30 class AppSearchProvider::App { | 31 class AppSearchProvider::App { |
| 31 public: | 32 public: |
| 32 explicit App(const extensions::Extension* extension, | 33 explicit App(const extensions::Extension* extension, |
| 33 const base::Time& last_launch_time) | 34 const base::Time& last_launch_time) |
| 34 : app_id_(extension->id()), | 35 : app_id_(extension->id()), |
| 35 indexed_name_(base::UTF8ToUTF16(extension->name())), | 36 indexed_name_(base::UTF8ToUTF16(switches::IsExperimentalAppListEnabled() |
|
Matt Giuca
2015/02/12 02:17:48
Ideally, this would not be gated on whether the ex
| |
| 37 ? extension->short_name() | |
| 38 : extension->name())), | |
| 36 last_launch_time_(last_launch_time) {} | 39 last_launch_time_(last_launch_time) {} |
| 37 ~App() {} | 40 ~App() {} |
| 38 | 41 |
| 39 const std::string& app_id() const { return app_id_; } | 42 const std::string& app_id() const { return app_id_; } |
| 40 const TokenizedString& indexed_name() const { return indexed_name_; } | 43 const TokenizedString& indexed_name() const { return indexed_name_; } |
| 41 const base::Time& last_launch_time() const { return last_launch_time_; } | 44 const base::Time& last_launch_time() const { return last_launch_time_; } |
| 42 | 45 |
| 43 private: | 46 private: |
| 44 const std::string app_id_; | 47 const std::string app_id_; |
| 45 TokenizedString indexed_name_; | 48 TokenizedString indexed_name_; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 RefreshApps(); | 155 RefreshApps(); |
| 153 if (!update_results_factory_.HasWeakPtrs()) { | 156 if (!update_results_factory_.HasWeakPtrs()) { |
| 154 base::MessageLoop::current()->PostTask( | 157 base::MessageLoop::current()->PostTask( |
| 155 FROM_HERE, | 158 FROM_HERE, |
| 156 base::Bind(&AppSearchProvider::UpdateResults, | 159 base::Bind(&AppSearchProvider::UpdateResults, |
| 157 update_results_factory_.GetWeakPtr())); | 160 update_results_factory_.GetWeakPtr())); |
| 158 } | 161 } |
| 159 } | 162 } |
| 160 | 163 |
| 161 } // namespace app_list | 164 } // namespace app_list |
| OLD | NEW |