Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/browser_plugin/browser_plugin.h" | 5 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #if defined (OS_WIN) | 9 #if defined (OS_WIN) |
| 10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 : instance_id_(instance_id), | 65 : instance_id_(instance_id), |
| 66 render_view_(render_view), | 66 render_view_(render_view), |
| 67 container_(NULL), | 67 container_(NULL), |
| 68 damage_buffer_(NULL), | 68 damage_buffer_(NULL), |
| 69 sad_guest_(NULL), | 69 sad_guest_(NULL), |
| 70 guest_crashed_(false), | 70 guest_crashed_(false), |
| 71 resize_pending_(false), | 71 resize_pending_(false), |
| 72 navigate_src_sent_(false), | 72 navigate_src_sent_(false), |
| 73 process_id_(-1), | 73 process_id_(-1), |
| 74 persist_storage_(false), | 74 persist_storage_(false), |
| 75 content_window_routing_id_(MSG_ROUTING_NONE), | |
| 75 visible_(true), | 76 visible_(true), |
| 76 current_nav_entry_index_(0), | 77 current_nav_entry_index_(0), |
| 77 nav_entry_count_(0) { | 78 nav_entry_count_(0) { |
| 78 BrowserPluginManager::Get()->AddBrowserPlugin(instance_id, this); | 79 BrowserPluginManager::Get()->AddBrowserPlugin(instance_id, this); |
| 79 bindings_.reset(new BrowserPluginBindings(this)); | 80 bindings_.reset(new BrowserPluginBindings(this)); |
| 80 | 81 |
| 81 ParseAttributes(params); | 82 ParseAttributes(params); |
| 82 } | 83 } |
| 83 | 84 |
| 84 BrowserPlugin::~BrowserPlugin() { | 85 BrowserPlugin::~BrowserPlugin() { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 // guest's |src| to empty value, resize and then set the |src| to a | 136 // guest's |src| to empty value, resize and then set the |src| to a |
| 136 // non-empty value). | 137 // non-empty value). |
| 137 // Additionally, once this instance has navigated, the storage partition | 138 // Additionally, once this instance has navigated, the storage partition |
| 138 // cannot be changed, so this value is used for enforcing this. | 139 // cannot be changed, so this value is used for enforcing this. |
| 139 navigate_src_sent_ = true; | 140 navigate_src_sent_ = true; |
| 140 } | 141 } |
| 141 src_ = src; | 142 src_ = src; |
| 142 guest_crashed_ = false; | 143 guest_crashed_ = false; |
| 143 } | 144 } |
| 144 | 145 |
| 146 NPObject* BrowserPlugin::GetContentWindow() const { | |
|
abarth-chromium
2012/10/16 18:47:27
This function LGTM
Fady Samuel
2012/10/16 19:17:08
Thanks Adam.
| |
| 147 if (content_window_routing_id_ == MSG_ROUTING_NONE) | |
| 148 return NULL; | |
| 149 RenderViewImpl* guest_render_view = static_cast<RenderViewImpl*>( | |
| 150 ChildThread::current()->ResolveRoute(content_window_routing_id_)); | |
| 151 if (!guest_render_view) | |
| 152 return NULL; | |
| 153 WebKit::WebFrame* guest_frame = guest_render_view->GetWebView()->mainFrame(); | |
| 154 return guest_frame->windowObject(); | |
| 155 } | |
| 156 | |
| 145 std::string BrowserPlugin::GetPartitionAttribute() const { | 157 std::string BrowserPlugin::GetPartitionAttribute() const { |
| 146 std::string value; | 158 std::string value; |
| 147 if (persist_storage_) | 159 if (persist_storage_) |
| 148 value.append(kPersistPrefix); | 160 value.append(kPersistPrefix); |
| 149 | 161 |
| 150 value.append(storage_partition_id_); | 162 value.append(storage_partition_id_); |
| 151 return value; | 163 return value; |
| 152 } | 164 } |
| 153 | 165 |
| 154 bool BrowserPlugin::CanGoBack() const { | 166 bool BrowserPlugin::CanGoBack() const { |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 486 frame->callFunctionEvenIfScriptDisabled(*it, v8::Object::New(), 1, &val); | 498 frame->callFunctionEvenIfScriptDisabled(*it, v8::Object::New(), 1, &val); |
| 487 } | 499 } |
| 488 } | 500 } |
| 489 | 501 |
| 490 void BrowserPlugin::AdvanceFocus(bool reverse) { | 502 void BrowserPlugin::AdvanceFocus(bool reverse) { |
| 491 // We do not have a RenderView when we are testing. | 503 // We do not have a RenderView when we are testing. |
| 492 if (render_view_) | 504 if (render_view_) |
| 493 render_view_->GetWebView()->advanceFocus(reverse); | 505 render_view_->GetWebView()->advanceFocus(reverse); |
| 494 } | 506 } |
| 495 | 507 |
| 508 void BrowserPlugin::GuestContentWindowReady(int content_window_routing_id) { | |
| 509 DCHECK(content_window_routing_id != MSG_ROUTING_NONE); | |
| 510 content_window_routing_id_ = content_window_routing_id; | |
| 511 } | |
| 512 | |
| 496 void BrowserPlugin::SetAcceptTouchEvents(bool accept) { | 513 void BrowserPlugin::SetAcceptTouchEvents(bool accept) { |
| 497 if (container()) | 514 if (container()) |
| 498 container()->setIsAcceptingTouchEvents(accept); | 515 container()->setIsAcceptingTouchEvents(accept); |
| 499 } | 516 } |
| 500 | 517 |
| 501 bool BrowserPlugin::HasListeners(const std::string& event_name) { | 518 bool BrowserPlugin::HasListeners(const std::string& event_name) { |
| 502 return event_listener_map_.find(event_name) != event_listener_map_.end(); | 519 return event_listener_map_.find(event_name) != event_listener_map_.end(); |
| 503 } | 520 } |
| 504 | 521 |
| 505 bool BrowserPlugin::AddEventListener(const std::string& event_name, | 522 bool BrowserPlugin::AddEventListener(const std::string& event_name, |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 796 void* notify_data) { | 813 void* notify_data) { |
| 797 } | 814 } |
| 798 | 815 |
| 799 void BrowserPlugin::didFailLoadingFrameRequest( | 816 void BrowserPlugin::didFailLoadingFrameRequest( |
| 800 const WebKit::WebURL& url, | 817 const WebKit::WebURL& url, |
| 801 void* notify_data, | 818 void* notify_data, |
| 802 const WebKit::WebURLError& error) { | 819 const WebKit::WebURLError& error) { |
| 803 } | 820 } |
| 804 | 821 |
| 805 } // namespace content | 822 } // namespace content |
| OLD | NEW |