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

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: fix 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/observer_list.h"
14 #include "base/strings/string16.h"
13 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 15 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
14 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
15 17
16 namespace extensions { 18 namespace extensions {
17 class Extension; 19 class Extension;
18 } 20 }
19 21
20 class Profile; 22 class Profile;
21 23
22 namespace app_list { 24 namespace app_list {
23 25
24 class RecommendedApps; 26 class RecommendedApps;
27 class StartPageObserver;
25 28
26 // StartPageService collects data to be displayed in app list's start page 29 // StartPageService collects data to be displayed in app list's start page
27 // and hosts the start page contents. 30 // and hosts the start page contents.
28 class StartPageService : public BrowserContextKeyedService { 31 class StartPageService : public BrowserContextKeyedService {
29 public: 32 public:
30 typedef std::vector<scoped_refptr<const extensions::Extension> > 33 typedef std::vector<scoped_refptr<const extensions::Extension> >
31 ExtensionList; 34 ExtensionList;
32 // Gets the instance for the given profile. 35 // Gets the instance for the given profile.
33 static StartPageService* Get(Profile* profile); 36 static StartPageService* Get(Profile* profile);
34 37
38 void AddObserver(StartPageObserver* observer);
39 void RemoveObserver(StartPageObserver* observer);
40
35 content::WebContents* contents() { return contents_.get(); } 41 content::WebContents* contents() { return contents_.get(); }
36 RecommendedApps* recommended_apps() { return recommended_apps_.get(); } 42 RecommendedApps* recommended_apps() { return recommended_apps_.get(); }
43 void OnSearch(const base::string16& query);
37 44
38 private: 45 private:
39 // A BrowserContextKeyedServiceFactory for this service. 46 // A BrowserContextKeyedServiceFactory for this service.
40 class Factory; 47 class Factory;
41 48
42 // ExitObserver to shutdown the service on exiting. WebContents depends 49 // ExitObserver to shutdown the service on exiting. WebContents depends
43 // on the profile and needs to be closed before the profile and its 50 // on the profile and needs to be closed before the profile and its
44 // keyed service shutdown. 51 // keyed service shutdown.
45 class ExitObserver; 52 class ExitObserver;
46 53
47 // The WebContentsDelegate implementation for the start page. This allows 54 // The WebContentsDelegate implementation for the start page. This allows
48 // getUserMedia() request from the web contents. 55 // getUserMedia() request from the web contents.
49 class StartPageWebContentsDelegate; 56 class StartPageWebContentsDelegate;
50 57
51 explicit StartPageService(Profile* profile); 58 explicit StartPageService(Profile* profile);
52 virtual ~StartPageService(); 59 virtual ~StartPageService();
53 60
54 // BrowserContextKeyedService overrides: 61 // BrowserContextKeyedService overrides:
55 virtual void Shutdown() OVERRIDE; 62 virtual void Shutdown() OVERRIDE;
56 63
57 Profile* profile_; 64 Profile* profile_;
58 scoped_ptr<content::WebContents> contents_; 65 scoped_ptr<content::WebContents> contents_;
59 scoped_ptr<StartPageWebContentsDelegate> contents_delegate_; 66 scoped_ptr<StartPageWebContentsDelegate> contents_delegate_;
60 scoped_ptr<ExitObserver> exit_observer_; 67 scoped_ptr<ExitObserver> exit_observer_;
61 scoped_ptr<RecommendedApps> recommended_apps_; 68 scoped_ptr<RecommendedApps> recommended_apps_;
69 ObserverList<StartPageObserver> observers_;
62 70
63 DISALLOW_COPY_AND_ASSIGN(StartPageService); 71 DISALLOW_COPY_AND_ASSIGN(StartPageService);
64 }; 72 };
65 73
66 } // namespace app_list 74 } // namespace app_list
67 75
68 #endif // CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_ 76 #endif // CHROME_BROWSER_UI_APP_LIST_START_PAGE_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/start_page_observer.h ('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