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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 net::URLRequest::RegisterProtocolFactory("http", NULL); | 59 net::URLRequest::RegisterProtocolFactory("http", NULL); |
60 message_loop_.RunAllPending(); | 60 message_loop_.RunAllPending(); |
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::PluginList::Singleton()->RegisterInternalPlugin(pdf_path_); | 69 webkit::npapi::WebPluginInfo info; |
| 70 info.path = pdf_path_; |
| 71 info.enabled = true; |
| 72 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info); |
70 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 73 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
71 } | 74 } |
72 | 75 |
73 void UnregisterPDFPlugin() { | 76 void UnregisterPDFPlugin() { |
74 webkit::npapi::PluginList::Singleton()->UnregisterInternalPlugin(pdf_path_); | 77 webkit::npapi::PluginList::Singleton()->UnregisterInternalPlugin(pdf_path_); |
75 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 78 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
76 } | 79 } |
77 | 80 |
78 void SetPDFPluginLoadedState(bool want_loaded, bool* out_is_enabled) { | 81 void SetPDFPluginLoadedState(bool want_loaded, bool* out_is_enabled) { |
79 webkit::npapi::WebPluginInfo info; | 82 webkit::npapi::WebPluginInfo info; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 TEST_F(GViewRequestInterceptorTest, InterceptPowerpoint) { | 174 TEST_F(GViewRequestInterceptorTest, InterceptPowerpoint) { |
172 net::URLRequest request(GURL("http://foo.com/file.ppt"), &test_delegate_); | 175 net::URLRequest request(GURL("http://foo.com/file.ppt"), &test_delegate_); |
173 request.Start(); | 176 request.Start(); |
174 MessageLoop::current()->Run(); | 177 MessageLoop::current()->Run(); |
175 EXPECT_EQ(1, test_delegate_.received_redirect_count()); | 178 EXPECT_EQ(1, test_delegate_.received_redirect_count()); |
176 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"), |
177 request.url()); | 180 request.url()); |
178 } | 181 } |
179 | 182 |
180 } // namespace chromeos | 183 } // namespace chromeos |
OLD | NEW |