|
@@ -17,7 +17,6 @@
|
|
|
#include "atom/browser/child_web_contents_tracker.h"
|
|
|
#include "atom/browser/lib/bluetooth_chooser.h"
|
|
|
#include "atom/browser/native_window.h"
|
|
|
-#include "atom/browser/native_window_views.h"
|
|
|
#include "atom/browser/net/atom_network_delegate.h"
|
|
|
#include "atom/browser/osr/osr_output_device.h"
|
|
|
#include "atom/browser/osr/osr_render_widget_host_view.h"
|
|
@@ -84,7 +83,6 @@
|
|
|
#include "third_party/WebKit/public/web/WebFindOptions.h"
|
|
|
#include "ui/display/screen.h"
|
|
|
#include "ui/events/base_event_utils.h"
|
|
|
-#include "ui/gfx/geometry/rect_f.h"
|
|
|
|
|
|
#if !defined(OS_MACOSX)
|
|
|
#include "ui/aura/window.h"
|
|
@@ -443,8 +441,6 @@ void WebContents::InitWithSessionAndOptions(v8::Isolate* isolate,
|
|
|
registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING,
|
|
|
content::Source<content::NavigationController>(controller));
|
|
|
|
|
|
- autofill_popup_ = new AutofillPopup(web_contents->GetNativeView());
|
|
|
-
|
|
|
Init(isolate);
|
|
|
AttachAsUserData(web_contents);
|
|
|
}
|
|
@@ -744,17 +740,6 @@ void WebContents::RenderViewCreated(content::RenderViewHost* render_view_host) {
|
|
|
impl->disable_hidden_ = !background_throttling_;
|
|
|
}
|
|
|
|
|
|
-void WebContents::RenderFrameCreated(content::RenderFrameHost* host) {
|
|
|
- Send(new AtomAutofillViewHostMsg_RoutingId(
|
|
|
- host->GetRoutingID(), routing_id()));
|
|
|
-}
|
|
|
-
|
|
|
-void WebContents::RenderFrameHostChanged(content::RenderFrameHost* old_host,
|
|
|
- content::RenderFrameHost* new_host) {
|
|
|
- Send(new AtomAutofillViewHostMsg_RoutingId(
|
|
|
- new_host->GetRoutingID(), routing_id()));
|
|
|
-}
|
|
|
-
|
|
|
void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) {
|
|
|
Emit("render-view-deleted", render_view_host->GetProcess()->GetID());
|
|
|
}
|
|
@@ -991,8 +976,23 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
|
|
|
OnGetZoomLevel)
|
|
|
IPC_MESSAGE_HANDLER_CODE(ViewHostMsg_SetCursor, OnCursorChange,
|
|
|
handled = false)
|
|
|
- IPC_MESSAGE_HANDLER(AtomAutofillViewMsg_ShowPopup, OnShowAutofillPopup)
|
|
|
- IPC_MESSAGE_HANDLER(AtomAutofillViewMsg_HidePopup, OnHideAutofillPopup)
|
|
|
+ IPC_MESSAGE_UNHANDLED(handled = false)
|
|
|
+ IPC_END_MESSAGE_MAP()
|
|
|
+
|
|
|
+ return handled;
|
|
|
+}
|
|
|
+
|
|
|
+bool WebContents::OnMessageReceived(const IPC::Message& message,
|
|
|
+ content::RenderFrameHost* frame_host) {
|
|
|
+ bool handled = true;
|
|
|
+ auto relay = NativeWindowRelay::FromWebContents(web_contents());
|
|
|
+ if (!relay)
|
|
|
+ return false;
|
|
|
+ IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(NativeWindow, message, frame_host)
|
|
|
+ IPC_MESSAGE_FORWARD(AtomAutofillFrameHostMsg_ShowPopup,
|
|
|
+ relay->window.get(), NativeWindow::ShowAutofillPopup)
|
|
|
+ IPC_MESSAGE_FORWARD(AtomAutofillFrameHostMsg_HidePopup,
|
|
|
+ relay->window.get(), NativeWindow::HideAutofillPopup)
|
|
|
IPC_MESSAGE_UNHANDLED(handled = false)
|
|
|
IPC_END_MESSAGE_MAP()
|
|
|
|
|
@@ -1625,25 +1625,6 @@ void WebContents::OnCursorChange(const content::WebCursor& cursor) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void WebContents::OnShowAutofillPopup(
|
|
|
- int routing_id,
|
|
|
- const gfx::RectF& bounds,
|
|
|
- const std::vector<base::string16>& values,
|
|
|
- const std::vector<base::string16>& labels) {
|
|
|
- auto relay = reinterpret_cast<NativeWindowViews*>(
|
|
|
- NativeWindow::FromWebContents(web_contents()));
|
|
|
- autofill_popup_->CreateView(
|
|
|
- routing_id,
|
|
|
- web_contents(),
|
|
|
- IsOffScreen() || (embedder_ && embedder_->IsOffScreen()),
|
|
|
- relay->widget(),
|
|
|
- bounds);
|
|
|
- autofill_popup_->SetItems(values, labels);
|
|
|
-}
|
|
|
-void WebContents::OnHideAutofillPopup() {
|
|
|
- autofill_popup_->Hide();
|
|
|
-}
|
|
|
-
|
|
|
void WebContents::SetSize(const SetSizeParams& params) {
|
|
|
if (guest_delegate_)
|
|
|
guest_delegate_->SetSize(params);
|
|
@@ -1657,6 +1638,10 @@ bool WebContents::IsOffScreen() const {
|
|
|
return type_ == OFF_SCREEN;
|
|
|
}
|
|
|
|
|
|
+bool WebContents::IsOffScreenOrEmbedderOffscreen() const {
|
|
|
+ return IsOffScreen() || (embedder_ && embedder_->IsOffScreen());
|
|
|
+}
|
|
|
+
|
|
|
void WebContents::OnPaint(const gfx::Rect& dirty_rect, const SkBitmap& bitmap) {
|
|
|
Emit("paint", dirty_rect, gfx::Image::CreateFrom1xBitmap(bitmap));
|
|
|
}
|