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

Side by Side Diff: chrome/browser/search/suggestions/suggestions_source.h

Issue 170743009: Revert of Adding the chrome://suggestions test page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months 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
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_SOURCE_H_
6 #define CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_SOURCE_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/memory/weak_ptr.h"
12 #include "content/public/browser/url_data_source.h"
13
14 class Profile;
15
16 namespace base {
17 class RefCountedMemory;
18 } // namespace base
19
20 namespace suggestions {
21 class SuggestionsProfile;
22 } // namespace suggestions
23
24 // SuggestionsSource renders a webpage to list SuggestionsService data.
25 class SuggestionsSource : public content::URLDataSource {
26 public:
27 explicit SuggestionsSource(Profile* profile);
28
29 // content::URLDataSource implementation.
30 virtual std::string GetSource() const OVERRIDE;
31 virtual void StartDataRequest(
32 const std::string& path,
33 int render_process_id,
34 int render_frame_id,
35 const content::URLDataSource::GotDataCallback& callback) OVERRIDE;
36 virtual std::string GetMimeType(const std::string& path) const OVERRIDE;
37 virtual base::MessageLoop* MessageLoopForRequestPath(
38 const std::string& path) const OVERRIDE;
39 virtual bool ShouldServiceRequest(
40 const net::URLRequest* request) const OVERRIDE;
41
42 private:
43 virtual ~SuggestionsSource();
44
45 // Callback passed to a SuggestionsService instance.
46 void OnSuggestionsAvailable(
47 const content::URLDataSource::GotDataCallback& callback,
48 const suggestions::SuggestionsProfile& suggestions_profile);
49
50 // Only used when servicing requests on the UI thread.
51 Profile* const profile_;
52
53 // For callbacks may be run after destruction.
54 base::WeakPtrFactory<SuggestionsSource> weak_ptr_factory_;
55
56 DISALLOW_COPY_AND_ASSIGN(SuggestionsSource);
57 };
58
59 #endif // CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698