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

Side by Side Diff: chrome/browser/chromeos/gview_request_interceptor.h

Issue 7019030: Remove ProtocolFactory/Interceptor uses in GViewRequestInterceptor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix release. Created 9 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/gview_request_interceptor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_CHROMEOS_GVIEW_REQUEST_INTERCEPTOR_H__ 5 #ifndef CHROME_BROWSER_CHROMEOS_GVIEW_REQUEST_INTERCEPTOR_H__
6 #define CHROME_BROWSER_CHROMEOS_GVIEW_REQUEST_INTERCEPTOR_H__ 6 #define CHROME_BROWSER_CHROMEOS_GVIEW_REQUEST_INTERCEPTOR_H__
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
11 #include "net/url_request/url_request.h" 11 #include "net/url_request/url_request_job_factory.h"
12
13 template <typename T> struct DefaultSingletonTraits;
14 12
15 namespace chromeos { 13 namespace chromeos {
16 14
17 // This class integrates the Google Document Viewer into ChromeOS, 15 // This class integrates the Google Document Viewer into ChromeOS,
18 // enabling the viewing of supported document types that the user 16 // enabling the viewing of supported document types that the user
19 // clicks on. This class will intercept requests to supported 17 // clicks on. This class will intercept requests to supported
20 // document types (such as PDF) and redirect the request to the Google 18 // document types (such as PDF) and redirect the request to the Google
21 // Document Viewer, including the document's original URL as a 19 // Document Viewer, including the document's original URL as a
22 // parameter. 20 // parameter.
23 class GViewRequestInterceptor : public net::URLRequest::Interceptor { 21 class GViewRequestInterceptor : public net::URLRequestJobFactory::Interceptor {
24 public: 22 public:
23 GViewRequestInterceptor();
24 virtual ~GViewRequestInterceptor();
25
25 // Always returns NULL because we don't want to attempt a redirect 26 // Always returns NULL because we don't want to attempt a redirect
26 // before seeing the detected mime type of the request. 27 // before seeing the detected mime type of the request.
27 virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request); 28 virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request) const;
29
30 // Always returns NULL.
31 virtual net::URLRequestJob* MaybeInterceptRedirect(
32 const GURL& location,
33 net::URLRequest* request) const;
28 34
29 // Determines if the requested document can be viewed by the Google 35 // Determines if the requested document can be viewed by the Google
30 // Document Viewer. If it can, returns a net::URLRequestJob that 36 // Document Viewer. If it can, returns a net::URLRequestJob that
31 // redirects the browser to the view URL. 37 // redirects the browser to the view URL.
32 virtual net::URLRequestJob* MaybeInterceptResponse(net::URLRequest* request); 38 virtual net::URLRequestJob* MaybeInterceptResponse(
33 39 net::URLRequest* request) const;
34 // Singleton accessor.
35 static GViewRequestInterceptor* GetInstance();
36 40
37 private: 41 private:
38 friend struct DefaultSingletonTraits<GViewRequestInterceptor>;
39
40 GViewRequestInterceptor();
41 virtual ~GViewRequestInterceptor();
42
43 // The list of supported mime types. 42 // The list of supported mime types.
44 base::hash_set<std::string> supported_mime_types_; 43 base::hash_set<std::string> supported_mime_types_;
45 }; 44 };
46 45
47 } // namespace chromeos 46 } // namespace chromeos
48 47
49 #endif // CHROME_BROWSER_CHROMEOS_GVIEW_REQUEST_INTERCEPTOR_H__ 48 #endif // CHROME_BROWSER_CHROMEOS_GVIEW_REQUEST_INTERCEPTOR_H__
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/gview_request_interceptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698