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 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_RESULT_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_RESULT_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_RESULT_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_RESULT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" | 11 #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" |
12 #include "chrome/browser/ui/app_list/search/chrome_search_result.h" | |
13 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" | 12 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" |
14 #include "extensions/browser/extension_icon_image.h" | 13 #include "extensions/browser/extension_icon_image.h" |
15 #include "extensions/browser/extension_registry_observer.h" | 14 #include "extensions/browser/extension_registry_observer.h" |
| 15 #include "ui/app_list/search_result.h" |
16 | 16 |
17 class AppListControllerDelegate; | 17 class AppListControllerDelegate; |
18 class ExtensionEnableFlow; | 18 class ExtensionEnableFlow; |
19 class Profile; | 19 class Profile; |
20 | 20 |
21 namespace base { | 21 namespace base { |
22 class Time; | 22 class Time; |
23 } | 23 } |
24 | 24 |
25 namespace extensions { | 25 namespace extensions { |
26 class ExtensionRegistry; | 26 class ExtensionRegistry; |
27 } | 27 } |
28 | 28 |
29 namespace app_list { | 29 namespace app_list { |
30 | 30 |
31 class AppContextMenu; | 31 class AppContextMenu; |
32 class TokenizedString; | 32 class TokenizedString; |
33 class TokenizedStringMatch; | 33 class TokenizedStringMatch; |
34 | 34 |
35 class AppResult : public ChromeSearchResult, | 35 class AppResult : public SearchResult, |
36 public extensions::IconImage::Observer, | 36 public extensions::IconImage::Observer, |
37 public AppContextMenuDelegate, | 37 public AppContextMenuDelegate, |
38 public ExtensionEnableFlowDelegate, | 38 public ExtensionEnableFlowDelegate, |
39 public extensions::ExtensionRegistryObserver { | 39 public extensions::ExtensionRegistryObserver { |
40 public: | 40 public: |
41 AppResult(Profile* profile, | 41 AppResult(Profile* profile, |
42 const std::string& app_id, | 42 const std::string& app_id, |
43 AppListControllerDelegate* controller); | 43 AppListControllerDelegate* controller); |
44 virtual ~AppResult(); | 44 virtual ~AppResult(); |
45 | 45 |
46 void UpdateFromMatch(const TokenizedString& title, | 46 void UpdateFromMatch(const TokenizedString& title, |
47 const TokenizedStringMatch& match); | 47 const TokenizedStringMatch& match); |
48 | 48 |
49 void UpdateFromLastLaunched(const base::Time& current_time, | 49 void UpdateFromLastLaunched(const base::Time& current_time, |
50 const base::Time& last_launched); | 50 const base::Time& last_launched); |
51 | 51 |
52 // ChromeSearchResult overides: | 52 // SearchResult overrides: |
53 virtual void Open(int event_flags) override; | 53 virtual void Open(int event_flags) override; |
54 virtual void InvokeAction(int action_index, int event_flags) override; | 54 virtual scoped_ptr<SearchResult> Duplicate() override; |
55 virtual scoped_ptr<ChromeSearchResult> Duplicate() override; | |
56 virtual ui::MenuModel* GetContextMenuModel() override; | 55 virtual ui::MenuModel* GetContextMenuModel() override; |
57 virtual ChromeSearchResultType GetType() override; | |
58 | 56 |
59 private: | 57 private: |
60 void StartObservingExtensionRegistry(); | 58 void StartObservingExtensionRegistry(); |
61 void StopObservingExtensionRegistry(); | 59 void StopObservingExtensionRegistry(); |
62 | 60 |
63 // Checks if extension is disabled and if enable flow should be started. | 61 // Checks if extension is disabled and if enable flow should be started. |
64 // Returns true if extension enable flow is started or there is already one | 62 // Returns true if extension enable flow is started or there is already one |
65 // running. | 63 // running. |
66 bool RunExtensionEnableFlow(); | 64 bool RunExtensionEnableFlow(); |
67 | 65 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 scoped_ptr<ExtensionEnableFlow> extension_enable_flow_; | 97 scoped_ptr<ExtensionEnableFlow> extension_enable_flow_; |
100 | 98 |
101 extensions::ExtensionRegistry* extension_registry_; | 99 extensions::ExtensionRegistry* extension_registry_; |
102 | 100 |
103 DISALLOW_COPY_AND_ASSIGN(AppResult); | 101 DISALLOW_COPY_AND_ASSIGN(AppResult); |
104 }; | 102 }; |
105 | 103 |
106 } // namespace app_list | 104 } // namespace app_list |
107 | 105 |
108 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_RESULT_H_ | 106 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_RESULT_H_ |
OLD | NEW |