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 "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 "base/time.h" | 10 #include "base/time.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 if (!instance) | 43 if (!instance) |
44 return PP_MakeUndefined(); | 44 return PP_MakeUndefined(); |
45 | 45 |
46 GURL gurl(url); | 46 GURL gurl(url); |
47 if (!gurl.is_valid()) | 47 if (!gurl.is_valid()) |
48 return PP_MakeUndefined(); | 48 return PP_MakeUndefined(); |
49 | 49 |
50 std::string proxy_host = instance->delegate()->ResolveProxy(gurl); | 50 std::string proxy_host = instance->delegate()->ResolveProxy(gurl); |
51 if (proxy_host.empty()) | 51 if (proxy_host.empty()) |
52 return PP_MakeUndefined(); // No proxy. | 52 return PP_MakeUndefined(); // No proxy. |
53 return StringVar::StringToPPVar(instance->module()->pp_module(), proxy_host); | 53 return StringVar::StringToPPVar(proxy_host); |
54 } | 54 } |
55 | 55 |
56 int32_t Navigate(PP_Resource request_id, | 56 int32_t Navigate(PP_Resource request_id, |
57 const char* target, | 57 const char* target, |
58 bool from_user_action) { | 58 bool from_user_action) { |
59 EnterResource<PPB_URLRequestInfo_API> enter(request_id, true); | 59 EnterResource<PPB_URLRequestInfo_API> enter(request_id, true); |
60 if (enter.failed()) | 60 if (enter.failed()) |
61 return PP_ERROR_BADRESOURCE; | 61 return PP_ERROR_BADRESOURCE; |
62 PPB_URLRequestInfo_Impl* request = | 62 PPB_URLRequestInfo_Impl* request = |
63 static_cast<PPB_URLRequestInfo_Impl*>(enter.object()); | 63 static_cast<PPB_URLRequestInfo_Impl*>(enter.object()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 PP_Var GetCommandLineArgs(PP_Module pp_module) { | 103 PP_Var GetCommandLineArgs(PP_Module pp_module) { |
104 PluginModule* module = HostGlobals::Get()->GetModule(pp_module); | 104 PluginModule* module = HostGlobals::Get()->GetModule(pp_module); |
105 if (!module) | 105 if (!module) |
106 return PP_MakeUndefined(); | 106 return PP_MakeUndefined(); |
107 | 107 |
108 PluginInstance* instance = module->GetSomeInstance(); | 108 PluginInstance* instance = module->GetSomeInstance(); |
109 if (!instance) | 109 if (!instance) |
110 return PP_MakeUndefined(); | 110 return PP_MakeUndefined(); |
111 | 111 |
112 std::string args = instance->delegate()->GetFlashCommandLineArgs(); | 112 std::string args = instance->delegate()->GetFlashCommandLineArgs(); |
113 return StringVar::StringToPPVar(pp_module, args); | 113 return StringVar::StringToPPVar(args); |
114 } | 114 } |
115 | 115 |
116 const PPB_Flash ppb_flash = { | 116 const PPB_Flash ppb_flash = { |
117 &SetInstanceAlwaysOnTop, | 117 &SetInstanceAlwaysOnTop, |
118 &PPB_Flash_Impl::DrawGlyphs, | 118 &PPB_Flash_Impl::DrawGlyphs, |
119 &GetProxyForURL, | 119 &GetProxyForURL, |
120 &Navigate, | 120 &Navigate, |
121 &RunMessageLoop, | 121 &RunMessageLoop, |
122 &QuitMessageLoop, | 122 &QuitMessageLoop, |
123 &GetLocalTimeZoneOffset, | 123 &GetLocalTimeZoneOffset, |
124 &GetCommandLineArgs | 124 &GetCommandLineArgs |
125 }; | 125 }; |
126 | 126 |
127 } // namespace | 127 } // namespace |
128 | 128 |
129 // static | 129 // static |
130 const PPB_Flash* PPB_Flash_Impl::GetInterface() { | 130 const PPB_Flash* PPB_Flash_Impl::GetInterface() { |
131 return &ppb_flash; | 131 return &ppb_flash; |
132 } | 132 } |
133 | 133 |
134 } // namespace ppapi | 134 } // namespace ppapi |
135 } // namespace webkit | 135 } // namespace webkit |
OLD | NEW |