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

Unified Diff: content/renderer/browser_plugin/browser_plugin_impl.cc

Issue 12326168: Move <webview> API to chrome layer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with ToT Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/browser_plugin/browser_plugin_impl.cc
diff --git a/content/renderer/browser_plugin/browser_plugin_impl.cc b/content/renderer/browser_plugin/browser_plugin_impl.cc
index 716a6927a2662ecd1859266d68fc98e357b18aa6..8bb6adf3cf91d73c7785c9be0e25dc1ce55485f1 100644
--- a/content/renderer/browser_plugin/browser_plugin_impl.cc
+++ b/content/renderer/browser_plugin/browser_plugin_impl.cc
@@ -85,7 +85,7 @@ BrowserPluginImpl::BrowserPluginImpl(
resize_ack_received_(true),
sad_guest_(NULL),
guest_crashed_(false),
- navigate_src_sent_(false),
+ guest_allocated_(false),
auto_size_ack_pending_(false),
guest_process_id_(-1),
guest_route_id_(-1),
@@ -102,14 +102,13 @@ BrowserPluginImpl::BrowserPluginImpl(
compositing_enabled_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(
weak_ptr_factory_(this)) {
- GetContentClient()->renderer()->BrowserPluginCreated(this);
}
BrowserPluginImpl::~BrowserPluginImpl() {
// If the BrowserPlugin has never navigated then the browser process and
// BrowserPluginManager don't know about it and so there is nothing to do
// here.
- if (!navigate_src_sent_)
+ if (!guest_allocated_)
return;
browser_plugin_manager()->RemoveBrowserPlugin(instance_id_);
browser_plugin_manager()->Send(
@@ -225,7 +224,7 @@ std::string BrowserPluginImpl::GetPartitionAttribute() const {
}
void BrowserPluginImpl::ParseNameAttribute() {
- if (!navigate_src_sent_)
+ if (!guest_allocated_)
return;
browser_plugin_manager()->Send(
new BrowserPluginHostMsg_SetName(render_view_routing_id_,
@@ -245,7 +244,7 @@ bool BrowserPluginImpl::ParseSrcAttribute(std::string* error_message) {
// If we haven't created the guest yet, do so now. We will navigate it right
// after creation. If |src| is empty, we can delay the creation until we
// actually need it.
- if (!navigate_src_sent_) {
+ if (!guest_allocated_) {
// On initial navigation, we request an instance ID from the browser
// process. We essentially ignore all subsequent calls to SetSrcAttribute
// until we receive an instance ID. |allocate_instance_id_sent_|
@@ -289,7 +288,7 @@ void BrowserPluginImpl::UpdateGuestAutoSizeState(bool current_auto_size) {
// If we haven't yet heard back from the guest about the last resize request,
// then we don't issue another request until we do in
// BrowserPluginImpl::UpdateRect.
- if (!navigate_src_sent_ || !resize_ack_received_)
+ if (!guest_allocated_ || !resize_ack_received_)
return;
BrowserPluginHostMsg_AutoSize_Params auto_size_params;
BrowserPluginHostMsg_ResizeGuest_Params resize_guest_params;
@@ -357,7 +356,7 @@ void BrowserPluginImpl::SetInstanceID(int instance_id) {
// Record that we sent a navigation request to the browser process.
// Once this instance has navigated, the storage partition cannot be changed,
// so this value is used for enforcing this.
- navigate_src_sent_ = true;
+ guest_allocated_ = true;
}
void BrowserPluginImpl::OnAdvanceFocus(int instance_id, bool reverse) {
@@ -769,9 +768,9 @@ bool BrowserPluginImpl::ParsePartitionAttribute(std::string* error_message) {
bool BrowserPluginImpl::CanRemovePartitionAttribute(
std::string* error_message) {
- if (navigate_src_sent_)
+ if (guest_allocated_)
*error_message = browser_plugin::kErrorCannotRemovePartition;
- return !navigate_src_sent_;
+ return !guest_allocated_;
}
void BrowserPluginImpl::ParseAttributes() {
@@ -851,33 +850,8 @@ void BrowserPluginImpl::WeakCallbackForPersistObject(
}
}
-void BrowserPluginImpl::Back() {
- if (!navigate_src_sent_)
- return;
- browser_plugin_manager()->Send(
- new BrowserPluginHostMsg_Go(render_view_routing_id_,
- instance_id_, -1));
-}
-
-void BrowserPluginImpl::Forward() {
- if (!navigate_src_sent_)
- return;
- browser_plugin_manager()->Send(
- new BrowserPluginHostMsg_Go(render_view_routing_id_,
- instance_id_, 1));
-}
-
-void BrowserPluginImpl::Go(int relative_index) {
- if (!navigate_src_sent_)
- return;
- browser_plugin_manager()->Send(
- new BrowserPluginHostMsg_Go(render_view_routing_id_,
- instance_id_,
- relative_index));
-}
-
void BrowserPluginImpl::TerminateGuest() {
- if (!navigate_src_sent_ || guest_crashed_)
+ if (!guest_allocated_ || guest_crashed_)
return;
browser_plugin_manager()->Send(
new BrowserPluginHostMsg_TerminateGuest(render_view_routing_id_,
@@ -885,7 +859,7 @@ void BrowserPluginImpl::TerminateGuest() {
}
void BrowserPluginImpl::Stop() {
- if (!navigate_src_sent_)
+ if (!guest_allocated_)
return;
browser_plugin_manager()->Send(
new BrowserPluginHostMsg_Stop(render_view_routing_id_,
@@ -893,7 +867,7 @@ void BrowserPluginImpl::Stop() {
}
void BrowserPluginImpl::Reload() {
- if (!navigate_src_sent_)
+ if (!guest_allocated_)
return;
browser_plugin_manager()->Send(
new BrowserPluginHostMsg_Reload(render_view_routing_id_,
@@ -901,7 +875,7 @@ void BrowserPluginImpl::Reload() {
}
void BrowserPluginImpl::UpdateGuestFocusState() {
- if (!navigate_src_sent_)
+ if (!guest_allocated_)
return;
bool should_be_focused = ShouldGuestBeFocused();
browser_plugin_manager()->Send(new BrowserPluginHostMsg_SetFocus(
@@ -966,6 +940,7 @@ bool BrowserPluginImpl::initialize(WebPluginContainer* container) {
container_ = container;
container_->setWantsWheelEvents(true);
ParseAttributes();
+ GetContentClient()->renderer()->BrowserPluginCreated(this);
return true;
}
@@ -1064,7 +1039,7 @@ void BrowserPluginImpl::paint(WebCanvas* canvas, const WebRect& rect) {
canvas->drawRect(image_data_rect, paint);
// Stay a solid color if we have never set a non-empty src, or we don't have a
// backing store.
- if (!backing_store_.get() || !navigate_src_sent_)
+ if (!backing_store_.get() || !guest_allocated_)
return;
float inverse_scale_factor = 1.0f / backing_store_->GetScaleFactor();
canvas->scale(inverse_scale_factor, inverse_scale_factor);
@@ -1086,14 +1061,6 @@ bool BrowserPluginImpl::InBounds(const gfx::Point& position) const {
return result;
}
-RenderView* BrowserPluginImpl::GetRenderView() const {
- return render_view_.get();
-}
-
-WebKit::WebPluginContainer* BrowserPluginImpl::GetContainer() const {
- return container();
-}
-
void BrowserPluginImpl::AddMethodBinding(
BrowserPluginMethodBinding* method_binding) {
bindings_->AddMethodBinding(method_binding);
@@ -1104,6 +1071,18 @@ void BrowserPluginImpl::AddPropertyBinding(
bindings_->AddPropertyBinding(method_binding);
}
+RenderView* BrowserPluginImpl::GetRenderView() const {
+ return render_view_.get();
+}
+
+int BrowserPluginImpl::GetRoutingID() const {
+ return render_view_routing_id_;
+}
+
+WebKit::WebPluginContainer* BrowserPluginImpl::GetContainer() const {
+ return container();
+}
+
void BrowserPluginImpl::TriggerEvent(
const std::string& event_name,
std::map<std::string, base::Value*>* props) {
@@ -1180,8 +1159,8 @@ bool BrowserPluginImpl::HasDOMAttribute(
WebKit::WebString::fromUTF8(attribute_name));
}
-bool BrowserPluginImpl::HasNavigated() const {
- return navigate_src_sent_;
+bool BrowserPluginImpl::HasGuest() const {
+ return guest_allocated_;
}
bool BrowserPluginImpl::Send(IPC::Message* message) {
@@ -1213,7 +1192,7 @@ void BrowserPluginImpl::updateGeometry(
// until the previous one is ACK'ed.
// TODO(mthiesse): Assess the performance of calling GetAutoSizeAttribute() on
// resize.
- if (!navigate_src_sent_ ||
+ if (!guest_allocated_ ||
!resize_ack_received_ ||
(old_width == window_rect.width && old_height == window_rect.height) ||
GetAutoSizeAttribute()) {
@@ -1331,7 +1310,7 @@ void BrowserPluginImpl::updateVisibility(bool visible) {
return;
visible_ = visible;
- if (!navigate_src_sent_)
+ if (!guest_allocated_)
return;
if (compositing_helper_)
@@ -1349,7 +1328,7 @@ bool BrowserPluginImpl::acceptsInputEvents() {
bool BrowserPluginImpl::handleInputEvent(const WebKit::WebInputEvent& event,
WebKit::WebCursorInfo& cursor_info) {
- if (guest_crashed_ || !navigate_src_sent_ ||
+ if (guest_crashed_ || !guest_allocated_ ||
event.type == WebKit::WebInputEvent::ContextMenu)
return false;
browser_plugin_manager()->Send(
@@ -1367,7 +1346,7 @@ bool BrowserPluginImpl::handleDragStatusUpdate(
WebKit::WebDragOperationsMask mask,
const WebKit::WebPoint& position,
const WebKit::WebPoint& screen) {
- if (guest_crashed_ || !navigate_src_sent_)
+ if (guest_crashed_ || !guest_allocated_)
return false;
browser_plugin_manager()->Send(new BrowserPluginHostMsg_DragStatusUpdate(
render_view_routing_id_,
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin_impl.h ('k') | content/renderer/browser_plugin/browser_plugin_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698