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

Unified Diff: chrome/browser/chromeos/gview_request_interceptor.cc

Issue 2906010: Command line switch to disable GView PDF handling. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Remove command line flag, simplify. Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gview_request_interceptor.cc
diff --git a/chrome/browser/chromeos/gview_request_interceptor.cc b/chrome/browser/chromeos/gview_request_interceptor.cc
index 29f8b5bf82c2d8c80157626718885385d39eae52..dba4d9dcdeec11987fef45bc6783b62e9e435b79 100644
--- a/chrome/browser/chromeos/gview_request_interceptor.cc
+++ b/chrome/browser/chromeos/gview_request_interceptor.cc
@@ -4,19 +4,28 @@
#include "chrome/browser/chromeos/gview_request_interceptor.h"
+#include "base/file_path.h"
+#include "base/path_service.h"
+#include "chrome/common/chrome_paths.h"
#include "net/base/escape.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request_job.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_redirect_job.h"
#include "googleurl/src/gurl.h"
+#include "webkit/glue/plugins/plugin_list.h"
namespace chromeos {
+// The PDF mime type is treated special if the browser has a built-in
+// PDF viewer plug-in installed - we want to intercept only if we're
+// told to.
+static const char* const kPdfMimeType = "application/pdf";
+
// This is the list of mime types currently supported by the Google
// Document Viewer.
static const char* const supported_mime_type_list[] = {
- "application/pdf",
+ kPdfMimeType,
"application/vnd.ms-powerpoint"
};
@@ -48,6 +57,16 @@ URLRequestJob* GViewRequestInterceptor::MaybeInterceptResponse(
std::string mime_type;
request->GetMimeType(&mime_type);
+ // If the local PDF viewing plug-in is installed and enabled, don't
+ // redirect PDF files to Google Document Viewer.
+ if (mime_type == kPdfMimeType) {
+ FilePath pdf_path;
+ WebPluginInfo info;
+ PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path);
+ if (NPAPI::PluginList::Singleton()->GetPluginInfoByPath(pdf_path, &info) &&
+ info.enabled)
+ return NULL;
+ }
// If supported, build the URL to the Google Document Viewer
// including the origial document's URL, then create a new job that
// will redirect the browser to this new URL.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698