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

Side by Side Diff: webkit/plugins/ppapi/ppb_flash_impl.cc

Issue 6745021: Rename PPB_Flash::NavigateToURL() (to Navigate()) and make it take an URLRequestInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "webkit/plugins/ppapi/ppb_flash_impl.h" 5 #include "webkit/plugins/ppapi/ppb_flash_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
11 #include "ppapi/c/private/ppb_flash.h" 11 #include "ppapi/c/private/ppb_flash.h"
12 #include "webkit/plugins/ppapi/common.h" 12 #include "webkit/plugins/ppapi/common.h"
13 #include "webkit/plugins/ppapi/plugin_delegate.h" 13 #include "webkit/plugins/ppapi/plugin_delegate.h"
14 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 14 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
15 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h"
15 #include "webkit/plugins/ppapi/resource_tracker.h" 16 #include "webkit/plugins/ppapi/resource_tracker.h"
16 #include "webkit/plugins/ppapi/var.h" 17 #include "webkit/plugins/ppapi/var.h"
17 18
18 namespace webkit { 19 namespace webkit {
19 namespace ppapi { 20 namespace ppapi {
20 21
21 namespace { 22 namespace {
22 23
23 void SetInstanceAlwaysOnTop(PP_Instance pp_instance, PP_Bool on_top) { 24 void SetInstanceAlwaysOnTop(PP_Instance pp_instance, PP_Bool on_top) {
24 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); 25 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
(...skipping 10 matching lines...) Expand all
35 GURL gurl(url); 36 GURL gurl(url);
36 if (!gurl.is_valid()) 37 if (!gurl.is_valid())
37 return PP_MakeUndefined(); 38 return PP_MakeUndefined();
38 39
39 std::string proxy_host = instance->delegate()->ResolveProxy(gurl); 40 std::string proxy_host = instance->delegate()->ResolveProxy(gurl);
40 if (proxy_host.empty()) 41 if (proxy_host.empty())
41 return PP_MakeUndefined(); // No proxy. 42 return PP_MakeUndefined(); // No proxy.
42 return StringVar::StringToPPVar(instance->module(), proxy_host); 43 return StringVar::StringToPPVar(instance->module(), proxy_host);
43 } 44 }
44 45
45 PP_Bool NavigateToURL(PP_Instance pp_instance, 46 int32_t Navigate(PP_Resource request_id,
46 const char* url, 47 const char* target,
47 const char* target) { 48 bool from_user_action) {
48 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); 49 scoped_refptr<PPB_URLRequestInfo_Impl> request(
50 Resource::GetAs<PPB_URLRequestInfo_Impl>(request_id));
51 if (!request)
52 return PP_ERROR_BADRESOURCE;
53
54 if (!target)
55 return PP_ERROR_BADARGUMENT;
56
57 PluginInstance* instance = request->instance();
49 if (!instance) 58 if (!instance)
50 return PP_FALSE; 59 return PP_ERROR_FAILED;
51 return BoolToPPBool(instance->NavigateToURL(url, target)); 60
61 return BoolToPPBool(instance->Navigate(request, target, from_user_action));
piman 2011/03/25 22:07:30 remove BoolToPPBool
52 } 62 }
53 63
54 void RunMessageLoop(PP_Instance instance) { 64 void RunMessageLoop(PP_Instance instance) {
55 bool old_state = MessageLoop::current()->NestableTasksAllowed(); 65 bool old_state = MessageLoop::current()->NestableTasksAllowed();
56 MessageLoop::current()->SetNestableTasksAllowed(true); 66 MessageLoop::current()->SetNestableTasksAllowed(true);
57 MessageLoop::current()->Run(); 67 MessageLoop::current()->Run();
58 MessageLoop::current()->SetNestableTasksAllowed(old_state); 68 MessageLoop::current()->SetNestableTasksAllowed(old_state);
59 } 69 }
60 70
61 void QuitMessageLoop(PP_Instance instance) { 71 void QuitMessageLoop(PP_Instance instance) {
62 MessageLoop::current()->QuitNow(); 72 MessageLoop::current()->QuitNow();
63 } 73 }
64 74
65 const PPB_Flash ppb_flash = { 75 const PPB_Flash ppb_flash = {
66 &SetInstanceAlwaysOnTop, 76 &SetInstanceAlwaysOnTop,
67 &PPB_Flash_Impl::DrawGlyphs, 77 &PPB_Flash_Impl::DrawGlyphs,
68 &GetProxyForURL, 78 &GetProxyForURL,
69 &NavigateToURL, 79 &Navigate,
70 &RunMessageLoop, 80 &RunMessageLoop,
71 &QuitMessageLoop, 81 &QuitMessageLoop,
72 }; 82 };
73 83
74 } // namespace 84 } // namespace
75 85
76 // static 86 // static
77 const PPB_Flash* PPB_Flash_Impl::GetInterface() { 87 const PPB_Flash* PPB_Flash_Impl::GetInterface() {
78 return &ppb_flash; 88 return &ppb_flash;
79 } 89 }
80 90
81 } // namespace ppapi 91 } // namespace ppapi
82 } // namespace webkit 92 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698