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

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

Issue 10855209: Refactoring: ProtocolHandler::MaybeCreateJob takes NetworkDelegate as argument (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest merge Created 8 years, 4 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
1 // Copyright (c) 2011 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 7
8 #include <string> 8 #include <string>
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
11 #include "net/url_request/url_request_job_factory.h" 11 #include "net/url_request/url_request_job_factory.h"
12 12
13 namespace chromeos { 13 namespace chromeos {
14 14
15 // This class integrates the Google Document Viewer into ChromeOS, 15 // This class integrates the Google Document Viewer into ChromeOS,
16 // enabling the viewing of supported document types that the user 16 // enabling the viewing of supported document types that the user
17 // clicks on. This class will intercept requests to supported 17 // clicks on. This class will intercept requests to supported
18 // 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
19 // Document Viewer, including the document's original URL as a 19 // Document Viewer, including the document's original URL as a
20 // parameter. 20 // parameter.
21 class GViewRequestInterceptor : public net::URLRequestJobFactory::Interceptor { 21 class GViewRequestInterceptor : public net::URLRequestJobFactory::Interceptor {
22 public: 22 public:
23 GViewRequestInterceptor(); 23 GViewRequestInterceptor();
24 virtual ~GViewRequestInterceptor(); 24 virtual ~GViewRequestInterceptor();
25 25
26 // 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
27 // before seeing the detected mime type of the request. 27 // before seeing the detected mime type of the request.
28 virtual net::URLRequestJob* MaybeIntercept( 28 virtual net::URLRequestJob* MaybeIntercept(
29 net::URLRequest* request) const OVERRIDE; 29 net::URLRequest* request,
30 net::NetworkDelegate* network_delegate) const OVERRIDE;
30 31
31 // Always returns NULL. 32 // Always returns NULL.
32 virtual net::URLRequestJob* MaybeInterceptRedirect( 33 virtual net::URLRequestJob* MaybeInterceptRedirect(
33 const GURL& location, 34 const GURL& location,
34 net::URLRequest* request) const OVERRIDE; 35 net::URLRequest* request,
36 net::NetworkDelegate* network_delegate) const OVERRIDE;
35 37
36 // Determines if the requested document can be viewed by the Google 38 // Determines if the requested document can be viewed by the Google
37 // Document Viewer. If it can, returns a net::URLRequestJob that 39 // Document Viewer. If it can, returns a net::URLRequestJob that
38 // redirects the browser to the view URL. 40 // redirects the browser to the view URL.
39 virtual net::URLRequestJob* MaybeInterceptResponse( 41 virtual net::URLRequestJob* MaybeInterceptResponse(
40 net::URLRequest* request) const OVERRIDE; 42 net::URLRequest* request,
43 net::NetworkDelegate* network_delegate) const OVERRIDE;
41 44
42 private: 45 private:
43 bool ShouldUsePdfPlugin(net::URLRequest* request) const; 46 bool ShouldUsePdfPlugin(net::URLRequest* request) const;
44 bool ShouldInterceptScheme(const std::string& scheme) const; 47 bool ShouldInterceptScheme(const std::string& scheme) const;
45 48
46 // The list of supported mime types. 49 // The list of supported mime types.
47 base::hash_set<std::string> supported_mime_types_; 50 base::hash_set<std::string> supported_mime_types_;
48 }; 51 };
49 52
50 } // namespace chromeos 53 } // namespace chromeos
51 54
52 #endif // CHROME_BROWSER_CHROMEOS_GVIEW_REQUEST_INTERCEPTOR_H__ 55 #endif // CHROME_BROWSER_CHROMEOS_GVIEW_REQUEST_INTERCEPTOR_H__
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_protocol_handler.cc ('k') | chrome/browser/chromeos/gview_request_interceptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698