Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: chrome/browser/ui/app_list/start_page_service.h

Issue 55433002: Propagates the search result of start page to the app-list search box. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_START_PAGE_SERVICE_H_ 5 #ifndef CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_
6 #define CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ 6 #define CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string16.h"
13 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 14 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
14 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
15 16
16 namespace extensions { 17 namespace extensions {
17 class Extension; 18 class Extension;
18 } 19 }
19 20
20 class Profile; 21 class Profile;
21 22
22 namespace app_list { 23 namespace app_list {
23 24
25 class AppListModel;
24 class RecommendedApps; 26 class RecommendedApps;
25 27
26 // StartPageService collects data to be displayed in app list's start page 28 // StartPageService collects data to be displayed in app list's start page
27 // and hosts the start page contents. 29 // and hosts the start page contents.
28 class StartPageService : public BrowserContextKeyedService { 30 class StartPageService : public BrowserContextKeyedService {
29 public: 31 public:
30 typedef std::vector<scoped_refptr<const extensions::Extension> > 32 typedef std::vector<scoped_refptr<const extensions::Extension> >
31 ExtensionList; 33 ExtensionList;
32 // Gets the instance for the given profile. 34 // Gets the instance for the given profile.
33 static StartPageService* Get(Profile* profile); 35 static StartPageService* Get(Profile* profile);
34 36
37 void SetAppListModel(AppListModel* model);
38
35 content::WebContents* contents() { return contents_.get(); } 39 content::WebContents* contents() { return contents_.get(); }
36 RecommendedApps* recommended_apps() { return recommended_apps_.get(); } 40 RecommendedApps* recommended_apps() { return recommended_apps_.get(); }
41 void OnSearch(const base::string16& query);
37 42
38 private: 43 private:
39 // A BrowserContextKeyedServiceFactory for this service. 44 // A BrowserContextKeyedServiceFactory for this service.
40 class Factory; 45 class Factory;
41 46
42 // ExitObserver to shutdown the service on exiting. WebContents depends 47 // ExitObserver to shutdown the service on exiting. WebContents depends
43 // on the profile and needs to be closed before the profile and its 48 // on the profile and needs to be closed before the profile and its
44 // keyed service shutdown. 49 // keyed service shutdown.
45 class ExitObserver; 50 class ExitObserver;
46 51
47 // The WebContentsDelegate implementation for the start page. This allows 52 // The WebContentsDelegate implementation for the start page. This allows
48 // getUserMedia() request from the web contents. 53 // getUserMedia() request from the web contents.
49 class StartPageWebContentsDelegate; 54 class StartPageWebContentsDelegate;
50 55
51 explicit StartPageService(Profile* profile); 56 explicit StartPageService(Profile* profile);
52 virtual ~StartPageService(); 57 virtual ~StartPageService();
53 58
54 // BrowserContextKeyedService overrides: 59 // BrowserContextKeyedService overrides:
55 virtual void Shutdown() OVERRIDE; 60 virtual void Shutdown() OVERRIDE;
56 61
57 Profile* profile_; 62 Profile* profile_;
63 AppListModel* model_;
xiyuan 2013/11/01 04:24:12 I don't like to put the weak reference to model he
Jun Mukai 2013/11/01 17:25:24 Agreed, done. PTAL.
58 scoped_ptr<content::WebContents> contents_; 64 scoped_ptr<content::WebContents> contents_;
59 scoped_ptr<StartPageWebContentsDelegate> contents_delegate_; 65 scoped_ptr<StartPageWebContentsDelegate> contents_delegate_;
60 scoped_ptr<ExitObserver> exit_observer_; 66 scoped_ptr<ExitObserver> exit_observer_;
61 scoped_ptr<RecommendedApps> recommended_apps_; 67 scoped_ptr<RecommendedApps> recommended_apps_;
62 68
63 DISALLOW_COPY_AND_ASSIGN(StartPageService); 69 DISALLOW_COPY_AND_ASSIGN(StartPageService);
64 }; 70 };
65 71
66 } // namespace app_list 72 } // namespace app_list
67 73
68 #endif // CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ 74 #endif // CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_view_delegate.cc ('k') | chrome/browser/ui/app_list/start_page_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698