OLD | NEW |
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 #include <string> | 5 #include <string> |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "chrome/browser/chromeos/gview_request_interceptor.h" | 7 #include "chrome/browser/chromeos/gview_request_interceptor.h" |
8 #include "chrome/browser/plugin_service.h" | 8 #include "chrome/browser/plugin_service.h" |
9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
10 #include "net/base/load_flags.h" | 10 #include "net/base/load_flags.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 | 62 |
63 static net::URLRequestJob* Factory(net::URLRequest* request, | 63 static net::URLRequestJob* Factory(net::URLRequest* request, |
64 const std::string& scheme) { | 64 const std::string& scheme) { |
65 return new GViewURLRequestTestJob(request); | 65 return new GViewURLRequestTestJob(request); |
66 } | 66 } |
67 | 67 |
68 void RegisterPDFPlugin() { | 68 void RegisterPDFPlugin() { |
69 webkit::npapi::WebPluginInfo info; | 69 webkit::npapi::WebPluginInfo info; |
70 info.path = pdf_path_; | 70 info.path = pdf_path_; |
71 info.name = ASCIIToUTF16("Internal PDF Plugin"); | |
72 info.enabled = webkit::npapi::WebPluginInfo::USER_ENABLED_POLICY_UNMANAGED; | 71 info.enabled = webkit::npapi::WebPluginInfo::USER_ENABLED_POLICY_UNMANAGED; |
73 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info); | 72 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info); |
74 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 73 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
75 } | 74 } |
76 | 75 |
77 void UnregisterPDFPlugin() { | 76 void UnregisterPDFPlugin() { |
78 webkit::npapi::PluginList::Singleton()->UnregisterInternalPlugin(pdf_path_); | 77 webkit::npapi::PluginList::Singleton()->UnregisterInternalPlugin(pdf_path_); |
79 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 78 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
80 } | 79 } |
81 | 80 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 TEST_F(GViewRequestInterceptorTest, InterceptPowerpoint) { | 174 TEST_F(GViewRequestInterceptorTest, InterceptPowerpoint) { |
176 net::URLRequest request(GURL("http://foo.com/file.ppt"), &test_delegate_); | 175 net::URLRequest request(GURL("http://foo.com/file.ppt"), &test_delegate_); |
177 request.Start(); | 176 request.Start(); |
178 MessageLoop::current()->Run(); | 177 MessageLoop::current()->Run(); |
179 EXPECT_EQ(1, test_delegate_.received_redirect_count()); | 178 EXPECT_EQ(1, test_delegate_.received_redirect_count()); |
180 EXPECT_EQ(GURL("http://docs.google.com/gview?url=http%3A//foo.com/file.ppt"), | 179 EXPECT_EQ(GURL("http://docs.google.com/gview?url=http%3A//foo.com/file.ppt"), |
181 request.url()); | 180 request.url()); |
182 } | 181 } |
183 | 182 |
184 } // namespace chromeos | 183 } // namespace chromeos |
OLD | NEW |