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

Side by Side Diff: extensions/renderer/resources/guest_view/extension_view.js

Issue 873933002: Add <extensionview> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move test files out of shim/ directory Created 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This module implements the ExtensionView <extensionview>.
6
7 var GuestViewContainer = require('guestViewContainer').GuestViewContainer;
8 var ExtensionViewConstants =
9 require('extensionViewConstants').ExtensionViewConstants;
10 var ExtensionViewInternal =
11 require('extensionViewInternal').ExtensionViewInternal;
12
13 function ExtensionViewImpl(extensionviewElement) {
14 GuestViewContainer.call(this, extensionviewElement, 'extensionview');
15 this.setupExtensionViewAttributes();
16 }
17
18 ExtensionViewImpl.prototype.__proto__ = GuestViewContainer.prototype;
19
20 ExtensionViewImpl.VIEW_TYPE = 'ExtensionView';
21
22 ExtensionViewImpl.setupElement = function(proto) {
23 var apiMethods = [
24 'navigate'
25 ];
26
27 GuestViewContainer.forwardApiMethods(proto, apiMethods);
28 };
29
30 ExtensionViewImpl.prototype.createGuest = function() {
31 this.guest.create(this.buildParams(), function() {
32 this.attachWindow();
33 }.bind(this));
34 };
35
36 ExtensionViewImpl.prototype.onElementAttached = function() {
37 this.attributes[ExtensionViewConstants.ATTRIBUTE_SRC].parse();
38 };
39
40 ExtensionViewImpl.prototype.buildContainerParams = function() {
41 var params = {};
42 for (var i in this.attributes) {
43 params[i] = this.attributes[i].getValue();
44 }
45 return params;
46 };
47
48 // This observer monitors mutations to attributes of the <extensionview>.
49 ExtensionViewImpl.prototype.handleAttributeMutation = function(
50 attributeName, oldValue, newValue) {
51 if (!this.attributes[attributeName])
52 return;
53
54 // Let the changed attribute handle its own mutation;
55 this.attributes[attributeName].handleMutation(oldValue, newValue);
56 };
57
58 ExtensionViewImpl.prototype.onElementDetached = function() {
59 this.guest.destroy();
60 this.attributes[ExtensionViewConstants.ATTRIBUTE_SRC].reset();
61 };
62
63 GuestViewContainer.registerElement(ExtensionViewImpl);
64
65 // Exports.
66 exports.ExtensionViewImpl = ExtensionViewImpl;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698