summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-06 03:00:40 +0000
committerrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-06 03:00:40 +0000
commite8345245dbeed71eed592c8a89e4b70403019e47 (patch)
tree5b9e56c874df5de0cee3656c8c901a2f41f51c32 /chrome/renderer
parent622b74522b0ee8aa0343dd48fbbd0230e9806d5e (diff)
downloadchromium_src-e8345245dbeed71eed592c8a89e4b70403019e47.zip
chromium_src-e8345245dbeed71eed592c8a89e4b70403019e47.tar.gz
chromium_src-e8345245dbeed71eed592c8a89e4b70403019e47.tar.bz2
Initial support for web-extent background pages.
This patch adds a new RVH container: BackgroundContents. The idea is that apps can open a live web-page as a "background" page using window.open('<url>', '<name>', 'background'); If 'background' is specified and the opener is within the app's extent, a BackgroundContents will be used. Otherwise, the 'background' feature is ignored and it is treated as a regular popup call. Note that as of this patch the following are explicitly not-yet addressed: 1) Session storage for BackgroundContents 2) SSL (or other failures) requiring UI 3) Javascript messages (alert, etc...) 4) Session restore TEST=All tests should pass BUG=41275 Review URL: http://codereview.chromium.org/1734014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46544 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/extensions/extension_process_bindings.cc10
-rw-r--r--chrome/renderer/render_view.cc14
-rw-r--r--chrome/renderer/render_view.h6
3 files changed, 16 insertions, 14 deletions
diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc
index a12ef09..0a586c4 100644
--- a/chrome/renderer/extensions/extension_process_bindings.cc
+++ b/chrome/renderer/extensions/extension_process_bindings.cc
@@ -15,6 +15,7 @@
#include "base/string_util.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/url_pattern.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
@@ -139,8 +140,9 @@ class ExtensionViewAccumulator : public RenderViewVisitor {
// match that of the arguments to the accumulator.
// See bug: http://crbug.com/29646
if (!(view_type_ == ViewType::EXTENSION_POPUP &&
- render_view->browser_window_id() == -1)) {
- if (browser_window_id_ != -1 &&
+ render_view->browser_window_id() ==
+ extension_misc::kUnknownWindowId)) {
+ if (browser_window_id_ != extension_misc::kUnknownWindowId &&
render_view->browser_window_id() != browser_window_id_) {
return true;
}
@@ -318,8 +320,8 @@ class ExtensionImpl : public ExtensionBase {
if (!args[0]->IsInt32() || !args[1]->IsString())
return v8::Undefined();
- // |browser_window_id| == -1 means getting views attached to any browser
- // window.
+ // |browser_window_id| == extension_misc::kUnknownWindowId means getting
+ // views attached to any browser window.
int browser_window_id = args[0]->Int32Value();
std::string view_type_string = *v8::String::Utf8Value(args[1]->ToString());
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 804df48..d76a5ac 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -379,7 +379,7 @@ RenderView::RenderView(RenderThreadBase* render_thread,
has_unload_listener_(false),
decrement_shared_popup_at_destruction_(false),
autofill_query_id_(0),
- popup_notification_visible_(false),
+ script_can_close_(true),
spelling_panel_visible_(false),
send_content_state_immediately_(false),
send_preferred_size_changes_(false),
@@ -653,8 +653,8 @@ void RenderView::OnMessageReceived(const IPC::Message& message) {
OnAutocompleteSuggestionsReturned)
IPC_MESSAGE_HANDLER(ViewMsg_AutoFillFormDataFilled,
OnAutoFillFormDataFilled)
- IPC_MESSAGE_HANDLER(ViewMsg_PopupNotificationVisibilityChanged,
- OnPopupNotificationVisibilityChanged)
+ IPC_MESSAGE_HANDLER(ViewMsg_AllowScriptToClose,
+ OnAllowScriptToClose)
IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted)
IPC_MESSAGE_HANDLER(ViewMsg_ExtensionResponse, OnExtensionResponse)
IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke,
@@ -1503,8 +1503,8 @@ void RenderView::OnAutoFillFormDataFilled(int query_id,
form_manager_.FillForm(form);
}
-void RenderView::OnPopupNotificationVisibilityChanged(bool visible) {
- popup_notification_visible_ = visible;
+void RenderView::OnAllowScriptToClose(bool script_can_close) {
+ script_can_close_ = script_can_close;
}
uint32 RenderView::GetCPBrowsingContext() {
@@ -1558,7 +1558,7 @@ WebView* RenderView::createView(
// This window can't be closed from a window.close() call until we receive a
// message from the Browser process explicitly allowing it.
- popup_notification_visible_ = true;
+ script_can_close_ = false;
int32 routing_id = MSG_ROUTING_NONE;
bool user_gesture = creator->isProcessingUserGesture();
@@ -2073,7 +2073,7 @@ void RenderView::show(WebNavigationPolicy policy) {
}
void RenderView::closeWidgetSoon() {
- if (!popup_notification_visible_)
+ if (script_can_close_)
RenderWidget::closeWidgetSoon();
}
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 1eda03e..ab2b4a4 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -771,8 +771,8 @@ class RenderView : public RenderWidget,
void OnAutoFillFormDataFilled(int query_id,
const webkit_glue::FormData& form);
- // Message that the popup notification has been shown or hidden.
- void OnPopupNotificationVisibilityChanged(bool visible);
+ // Message that script may use window.close().
+ void OnAllowScriptToClose(bool script_can_close);
// Handles messages posted from automation.
void OnMessageFromExternalHost(const std::string& message,
@@ -1086,7 +1086,7 @@ class RenderView : public RenderWidget,
// is being displayed. We instead assume that when we create a window off
// this RenderView, that it is going to be blocked until we get a message
// from the Browser process telling us otherwise.
- bool popup_notification_visible_;
+ bool script_can_close_;
// True if the browser is showing the spelling panel for us.
bool spelling_panel_visible_;