summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc1
-rw-r--r--chrome/renderer/resources/extensions/inject_app_titlebar.js49
-rw-r--r--chrome/renderer/resources/renderer_resources.grd3
-rw-r--r--extensions/browser/api/app_window/app_window_api.cc18
-rw-r--r--extensions/browser/api/app_window/app_window_api.h2
-rw-r--r--extensions/renderer/app_window_custom_bindings.cc50
-rw-r--r--extensions/renderer/app_window_custom_bindings.h6
-rw-r--r--extensions/renderer/dispatcher.cc6
-rw-r--r--extensions/renderer/resources/app_window_custom_bindings.js6
9 files changed, 8 insertions, 133 deletions
diff --git a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
index 6d32ec0..937c4d3 100644
--- a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
+++ b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
@@ -226,7 +226,6 @@ void ChromeExtensionsDispatcherDelegate::PopulateSourceMap(
source_map->RegisterSource("chromeWebViewInternal",
IDR_CHROME_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS);
source_map->RegisterSource("chromeWebView", IDR_CHROME_WEB_VIEW_JS);
- source_map->RegisterSource("injectAppTitlebar", IDR_INJECT_APP_TITLEBAR_JS);
}
void ChromeExtensionsDispatcherDelegate::RequireAdditionalModules(
diff --git a/chrome/renderer/resources/extensions/inject_app_titlebar.js b/chrome/renderer/resources/extensions/inject_app_titlebar.js
deleted file mode 100644
index 9f2ba37..0000000
--- a/chrome/renderer/resources/extensions/inject_app_titlebar.js
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-exports.didCreateDocumentElement = function() {
- var root = document.documentElement.createShadowRoot();
- root.appendChild(document.createElement('style')).innerText =
- // TODO(jeremya): switch this to use automatic inlining once grit
- // supports inlining into JS. See http://crbug.com/146319.
- "x-titlebar { height: 24px; width: 100%; " +
- "position: fixed; left: 0; top: 0; }\n" +
- "div { margin-top: 24px; position: absolute; top: 0px; width: 100%; " +
- "-webkit-widget-region: region(control rectangle); }\n" +
- ":-webkit-full-screen * { display: none; }\n" +
- ":-webkit-full-screen-document * { display: none; }\n" +
- "div:-webkit-full-screen, div:-webkit-full-screen-document { " +
- "margin-top: 0; }\n" +
- "button { -webkit-widget-region: region(control rectangle); }\n" +
- "button.close { border: 0; background-color: transparent; " +
- "width: 16px; height: 16px; " +
- "position: absolute; right: 4px; top: 4px; }\n" +
- "button.close { background-image: url(data:image/png;base64," +
- "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA9ElEQVQ4T7VTQQ6CMBCk0H" +
- "AyIfAQbiZ+QHyDL/QLxqvx4MWDB+MvFAWMAuKsacmmSjkQSDbQ2Z3Z3WkQzsBHDOQ7owgs" +
- "MdUacTGmi3BeIFYcNycgciGlfFRVtcd3qoojz/PmdV0XOD8RGy1iCoQgT5G8IyREjni7IC" +
- "cg58ilwA7A8i4BwgMUxkKIV9M0PggTAoFlJpnwLhO5iEuFapq2s20CyoWIGbpeaRICyrI8" +
- "89FtAtqwGxdQ65yYsV8NcwVN5obR/uTJW4mQsfp2fgToGjPqbBjWeoJVfNRsbSskSO7+7B" +
- "sAiznZdgu6Qe97lH+htysv+AA10msRAt5JYQAAAABJRU5ErkJggg==); }\n" +
- "button.close:hover { background-image: url(data:image/png;base64," +
- "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABTElEQVQ4T2NkoBAwUqifAc" +
- "WA////KwANFAPiV4yMjA+QDcclBzcApCA6Otpz2bJluQkJCf3z58/fDTMEnxyyAWZADQuA" +
- "tj4B4ncpKSnbZs+efQjkCqjBmUDmMyD+ADSwD6j2FEgOxQWJiYmuCxYscIYawpWamnr89+" +
- "/fHECxbKjmB2VlZbs6OzsvwFyHEQZATXZz5syxAGr4BMR8QCwJDYvn1dXVO1taWi4ihw9G" +
- "LID8m5aWZgt0viXUEBaQAUDNh9E1o3gBFuIgA6Be8QKK3QXiLyA5oNMvIDsdph7DC9AASw" +
- "cquI9sAJDNk5GRcX769OlHsXoBKapAoQ2KiQcgPwMDkbGrq8sGyP8DChNQwM6aNeswRiAC" +
- "DYBF4yOgwnuwAAM5NTMz03rGjBnWsIAFql2ANxqB/l2B7F/kgCUYjUBbyEvKsFAllaY4Nw" +
- "IAmJDPEd+LFvYAAAAASUVORK5CYII=); }\n" +
- "button.close:active { background-image: url(data:image/png;base64," +
- "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAZ0lEQVQ4T2NkoBAwUqifge" +
- "oG2AFd1AfERUB8CM11WOXQXXAGSROyITDNMGkTGAPdAHSFIENAAOQqGEBxHbYwQDcE2ScY" +
- "XsMViNgMwRYuOGOBIgMo8gLFgUi1aCQ7IZGcNaieF0h2AQCMABwRdsuhtQAAAABJRU5Erk" +
- "Jggg==); }\n"
- var titlebar = root.appendChild(document.createElement('x-titlebar'));
- var closeButton = titlebar.appendChild(document.createElement('button'));
- closeButton.className = 'close'
- closeButton.addEventListener('click', function() { window.close(); });
- var container = root.appendChild(document.createElement('div'));
- container.appendChild(document.createElement('content'));
-}
diff --git a/chrome/renderer/resources/renderer_resources.grd b/chrome/renderer/resources/renderer_resources.grd
index 3e38cc6..732d4c6 100644
--- a/chrome/renderer/resources/renderer_resources.grd
+++ b/chrome/renderer/resources/renderer_resources.grd
@@ -86,9 +86,6 @@
<include name="IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS" file="extensions\tts_engine_custom_bindings.js" type="BINDATA" />
<include name="IDR_WEBRTC_DESKTOP_CAPTURE_PRIVATE_CUSTOM_BINDINGS_JS" file="extensions\webrtc_desktop_capture_private_custom_bindings.js" type="BINDATA" />
<include name="IDR_WEBSTORE_CUSTOM_BINDINGS_JS" file="extensions\webstore_custom_bindings.js" type="BINDATA" />
-
- <!-- Platform app support. -->
- <include name="IDR_INJECT_APP_TITLEBAR_JS" file="extensions\inject_app_titlebar.js" type="BINDATA" />
</if>
</includes>
</release>
diff --git a/extensions/browser/api/app_window/app_window_api.cc b/extensions/browser/api/app_window/app_window_api.cc
index d7def0f..3e9f45f 100644
--- a/extensions/browser/api/app_window/app_window_api.cc
+++ b/extensions/browser/api/app_window/app_window_api.cc
@@ -75,8 +75,6 @@ const char kImeWindowMustBeImeWindowOrPanel[] =
} // namespace app_window_constants
const char kNoneFrameOption[] = "none";
- // TODO(benwells): Remove HTML titlebar injection.
-const char kHtmlFrameOption[] = "experimental-html";
namespace {
@@ -124,8 +122,7 @@ void CopyBoundsSpec(const app_window::BoundsSpecification* input_spec,
} // namespace
-AppWindowCreateFunction::AppWindowCreateFunction()
- : inject_html_titlebar_(false) {}
+AppWindowCreateFunction::AppWindowCreateFunction() {}
bool AppWindowCreateFunction::RunAsync() {
// Don't create app window if the system is shutting down.
@@ -198,8 +195,6 @@ bool AppWindowCreateFunction::RunAsync() {
result->Set("frameId", new base::FundamentalValue(frame_id));
existing_window->GetSerializedState(result);
result->SetBoolean("existingWindow", true);
- // TODO(benwells): Remove HTML titlebar injection.
- result->SetBoolean("injectTitlebar", false);
SetResult(result);
SendResponse(true);
return true;
@@ -360,8 +355,6 @@ bool AppWindowCreateFunction::RunAsync() {
base::DictionaryValue* result = new base::DictionaryValue;
result->Set("frameId", new base::FundamentalValue(frame_id));
- result->Set("injectTitlebar",
- new base::FundamentalValue(inject_html_titlebar_));
result->Set("id", new base::StringValue(app_window->window_key()));
app_window->GetSerializedState(result);
SetResult(result);
@@ -503,15 +496,6 @@ bool AppWindowCreateFunction::GetBoundsSpec(
AppWindow::Frame AppWindowCreateFunction::GetFrameFromString(
const std::string& frame_string) {
- if (frame_string == kHtmlFrameOption &&
- (extension()->permissions_data()->HasAPIPermission(
- APIPermission::kExperimental) ||
- base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableExperimentalExtensionApis))) {
- inject_html_titlebar_ = true;
- return AppWindow::FRAME_NONE;
- }
-
if (frame_string == kNoneFrameOption)
return AppWindow::FRAME_NONE;
diff --git a/extensions/browser/api/app_window/app_window_api.h b/extensions/browser/api/app_window/app_window_api.h
index f70aecb..f10ec98 100644
--- a/extensions/browser/api/app_window/app_window_api.h
+++ b/extensions/browser/api/app_window/app_window_api.h
@@ -36,8 +36,6 @@ class AppWindowCreateFunction : public AsyncExtensionFunction {
const extensions::api::app_window::CreateWindowOptions& options,
AppWindow::CreateParams* create_params);
void UpdateFrameOptionsForChannel(AppWindow::CreateParams* create_params);
-
- bool inject_html_titlebar_;
};
} // namespace extensions
diff --git a/extensions/renderer/app_window_custom_bindings.cc b/extensions/renderer/app_window_custom_bindings.cc
index b61c384..04e45a1 100644
--- a/extensions/renderer/app_window_custom_bindings.cc
+++ b/extensions/renderer/app_window_custom_bindings.cc
@@ -4,19 +4,14 @@
#include "extensions/renderer/app_window_custom_bindings.h"
-#include <string>
-
#include "base/command_line.h"
-#include "base/macros.h"
#include "content/public/child/v8_value_converter.h"
#include "content/public/renderer/render_frame.h"
-#include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h"
#include "extensions/common/extension_messages.h"
#include "extensions/common/switches.h"
#include "extensions/renderer/script_context.h"
-#include "extensions/renderer/script_context_set.h"
#include "grit/extensions_renderer_resources.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebView.h"
@@ -25,39 +20,8 @@
namespace extensions {
-class DidCreateDocumentElementObserver : public content::RenderFrameObserver {
- public:
- DidCreateDocumentElementObserver(content::RenderFrame* frame,
- const ScriptContextSet* script_context_set)
- : content::RenderFrameObserver(frame),
- script_context_set_(script_context_set) {
- DCHECK(script_context_set_);
- }
-
- void DidCreateDocumentElement() override {
- blink::WebLocalFrame* web_frame = render_frame()->GetWebFrame();
- // Don't attempt to inject the titlebar into iframes.
- if (web_frame->parent())
- return;
- ScriptContext* script_context = script_context_set_->GetByV8Context(
- web_frame->mainWorldScriptContext());
- if (!script_context)
- return;
- script_context->module_system()->CallModuleMethod(
- "injectAppTitlebar", "didCreateDocumentElement");
- }
-
- private:
- const ScriptContextSet* script_context_set_;
-
- DISALLOW_COPY_AND_ASSIGN(DidCreateDocumentElementObserver);
-};
-
-AppWindowCustomBindings::AppWindowCustomBindings(
- const ScriptContextSet* script_context_set,
- ScriptContext* context)
- : ObjectBackedNativeHandler(context),
- script_context_set_(script_context_set) {
+AppWindowCustomBindings::AppWindowCustomBindings(ScriptContext* context)
+ : ObjectBackedNativeHandler(context) {
RouteFunction("GetFrame", base::Bind(&AppWindowCustomBindings::GetFrame,
base::Unretained(this)));
@@ -70,19 +34,14 @@ void AppWindowCustomBindings::GetFrame(
const v8::FunctionCallbackInfo<v8::Value>& args) {
// TODO(jeremya): convert this to IDL nocompile to get validation, and turn
// these argument checks into CHECK().
- if (args.Length() != 2)
+ if (args.Length() != 1)
return;
if (!args[0]->IsInt32())
return;
- if (!args[1]->IsBoolean())
- return;
-
int frame_id = args[0]->Int32Value();
- bool inject_titlebar = args[1]->BooleanValue();
-
if (frame_id == MSG_ROUTING_NONE)
return;
@@ -99,9 +58,6 @@ void AppWindowCustomBindings::GetFrame(
if (!context_render_frame)
return;
- if (inject_titlebar)
- new DidCreateDocumentElementObserver(app_frame, script_context_set_);
-
blink::WebFrame* opener = context_render_frame->GetWebFrame();
blink::WebLocalFrame* app_web_frame = app_frame->GetWebFrame();
app_web_frame->setOpener(opener);
diff --git a/extensions/renderer/app_window_custom_bindings.h b/extensions/renderer/app_window_custom_bindings.h
index 26e02c7..3fbab04 100644
--- a/extensions/renderer/app_window_custom_bindings.h
+++ b/extensions/renderer/app_window_custom_bindings.h
@@ -14,8 +14,7 @@ class ScriptContextSet;
// Implements custom bindings for the app.window API.
class AppWindowCustomBindings : public ObjectBackedNativeHandler {
public:
- AppWindowCustomBindings(const ScriptContextSet* script_context_set,
- ScriptContext* context);
+ AppWindowCustomBindings(ScriptContext* context);
private:
void GetFrame(const v8::FunctionCallbackInfo<v8::Value>& args);
@@ -25,9 +24,6 @@ class AppWindowCustomBindings : public ObjectBackedNativeHandler {
void GetWindowControlsHtmlTemplate(
const v8::FunctionCallbackInfo<v8::Value>& args);
- // ScriptContextSet handle. Not owned.
- const ScriptContextSet* script_context_set_;
-
DISALLOW_COPY_AND_ASSIGN(AppWindowCustomBindings);
};
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index a8a2b3e..2c6ad7d 100644
--- a/extensions/renderer/dispatcher.cc
+++ b/extensions/renderer/dispatcher.cc
@@ -807,13 +807,9 @@ void Dispatcher::RegisterNativeHandlers(ModuleSystem* module_system,
scoped_ptr<NativeHandler>(new FileSystemNatives(context)));
// Custom bindings.
- // |dispatcher| is null in unit tests.
- const ScriptContextSet* script_context_set = dispatcher ?
- &dispatcher->script_context_set() : nullptr;
module_system->RegisterNativeHandler(
"app_window_natives",
- scoped_ptr<NativeHandler>(new AppWindowCustomBindings(
- script_context_set, context)));
+ scoped_ptr<NativeHandler>(new AppWindowCustomBindings(context)));
module_system->RegisterNativeHandler(
"blob_natives",
scoped_ptr<NativeHandler>(new BlobNativeHandler(context)));
diff --git a/extensions/renderer/resources/app_window_custom_bindings.js b/extensions/renderer/resources/app_window_custom_bindings.js
index 63f1eae..3800bea 100644
--- a/extensions/renderer/resources/app_window_custom_bindings.js
+++ b/extensions/renderer/resources/app_window_custom_bindings.js
@@ -118,10 +118,8 @@ appWindow.registerCustomHook(function(bindingsAPI) {
var view = null;
// When window creation fails, |windowParams| will be undefined.
- if (windowParams && windowParams.frameId) {
- view = appWindowNatives.GetFrame(
- windowParams.frameId, windowParams.injectTitlebar);
- }
+ if (windowParams && windowParams.frameId)
+ view = appWindowNatives.GetFrame(windowParams.frameId);
if (!view) {
// No route to created window. If given a callback, trigger it with an