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

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

Issue 5699005: Policy: Re-enabled plugin still disabled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Whitespace fixes only. Trybot happiness still applies. Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "chrome/browser/chromeos/gview_request_interceptor.h" 5 #include "chrome/browser/chromeos/gview_request_interceptor.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/singleton.h" 9 #include "base/singleton.h"
10 #include "chrome/common/chrome_paths.h" 10 #include "chrome/common/chrome_paths.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 std::string mime_type; 60 std::string mime_type;
61 request->GetMimeType(&mime_type); 61 request->GetMimeType(&mime_type);
62 // If the local PDF viewing plug-in is installed and enabled, don't 62 // If the local PDF viewing plug-in is installed and enabled, don't
63 // redirect PDF files to Google Document Viewer. 63 // redirect PDF files to Google Document Viewer.
64 if (mime_type == kPdfMimeType) { 64 if (mime_type == kPdfMimeType) {
65 FilePath pdf_path; 65 FilePath pdf_path;
66 webkit::npapi::WebPluginInfo info; 66 webkit::npapi::WebPluginInfo info;
67 PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path); 67 PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path);
68 if (webkit::npapi::PluginList::Singleton()->GetPluginInfoByPath( 68 if (webkit::npapi::PluginList::Singleton()->GetPluginInfoByPath(
69 pdf_path, &info) && 69 pdf_path, &info) &&
70 info.enabled) 70 webkit::npapi::IsPluginEnabled(info))
71 return NULL; 71 return NULL;
72 } 72 }
73 // If supported, build the URL to the Google Document Viewer 73 // If supported, build the URL to the Google Document Viewer
74 // including the origial document's URL, then create a new job that 74 // including the origial document's URL, then create a new job that
75 // will redirect the browser to this new URL. 75 // will redirect the browser to this new URL.
76 if (supported_mime_types_.count(mime_type) > 0) { 76 if (supported_mime_types_.count(mime_type) > 0) {
77 std::string url(kGViewUrlPrefix); 77 std::string url(kGViewUrlPrefix);
78 url += EscapePath(request->url().spec()); 78 url += EscapePath(request->url().spec());
79 return new net::URLRequestRedirectJob(request, GURL(url)); 79 return new net::URLRequestRedirectJob(request, GURL(url));
80 } 80 }
81 return NULL; 81 return NULL;
82 } 82 }
83 83
84 GViewRequestInterceptor* GViewRequestInterceptor::GetInstance() { 84 GViewRequestInterceptor* GViewRequestInterceptor::GetInstance() {
85 return Singleton<GViewRequestInterceptor>::get(); 85 return Singleton<GViewRequestInterceptor>::get();
86 } 86 }
87 87
88 } // namespace chromeos 88 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698