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

Side by Side Diff: chrome/renderer/resources/extensions/chrome_web_view_experimental.js

Issue 643903005: Swapped the variable names "WebView" and "WebViewInternal" in web_view.js and other files that impo… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This module implements experimental API for <webview>. 5 // This module implements experimental API for <webview>.
6 // See web_view.js for details. 6 // See web_view.js for details.
7 // 7 //
8 // <webview> Chrome Experimental API is only available on canary and dev 8 // <webview> Chrome Experimental API is only available on canary and dev
9 // channels of Chrome. 9 // channels of Chrome.
10 10
11 var ContextMenusSchema = 11 var ContextMenusSchema =
12 requireNative('schema_registry').GetSchema('contextMenus'); 12 requireNative('schema_registry').GetSchema('contextMenus');
13 var CreateEvent = require('webViewEvents').CreateEvent; 13 var CreateEvent = require('webViewEvents').CreateEvent;
14 var EventBindings = require('event_bindings'); 14 var EventBindings = require('event_bindings');
15 var MessagingNatives = requireNative('messaging_natives'); 15 var MessagingNatives = requireNative('messaging_natives');
16 //var WebView = require('webViewInternal').WebView;
17 var ChromeWebView = require('chromeWebViewInternal').ChromeWebView; 16 var ChromeWebView = require('chromeWebViewInternal').ChromeWebView;
18 var WebViewInternal = require('webView').WebViewInternal; 17 var WebView = require('webView').WebView;
19 var ChromeWebViewSchema = 18 var ChromeWebViewSchema =
lazyboy 2014/10/17 00:28:50 btw, can you sort these?
20 requireNative('schema_registry').GetSchema('chromeWebViewInternal'); 19 requireNative('schema_registry').GetSchema('chromeWebViewInternal');
21 var idGeneratorNatives = requireNative('id_generator'); 20 var idGeneratorNatives = requireNative('id_generator');
22 var utils = require('utils'); 21 var utils = require('utils');
23 22
24 function GetUniqueSubEventName(eventName) { 23 function GetUniqueSubEventName(eventName) {
25 return eventName + '/' + idGeneratorNatives.GetNextId(); 24 return eventName + '/' + idGeneratorNatives.GetNextId();
26 } 25 }
27 26
28 // This is the only "webViewInternal.onClicked" named event for this renderer. 27 // This is the only "webViewInternal.onClicked" named event for this renderer.
29 // 28 //
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 WebViewContextMenusImpl.prototype.update = function() { 87 WebViewContextMenusImpl.prototype.update = function() {
89 var args = $Array.concat([this.viewInstanceId_], $Array.slice(arguments)); 88 var args = $Array.concat([this.viewInstanceId_], $Array.slice(arguments));
90 return $Function.apply(ChromeWebView.contextMenusUpdate, null, args); 89 return $Function.apply(ChromeWebView.contextMenusUpdate, null, args);
91 }; 90 };
92 91
93 var WebViewContextMenus = utils.expose( 92 var WebViewContextMenus = utils.expose(
94 'WebViewContextMenus', WebViewContextMenusImpl, 93 'WebViewContextMenus', WebViewContextMenusImpl,
95 { functions: ['create', 'remove', 'removeAll', 'update'] }); 94 { functions: ['create', 'remove', 'removeAll', 'update'] });
96 95
97 /** @private */ 96 /** @private */
98 WebViewInternal.prototype.maybeHandleContextMenu = function(e, webViewEvent) { 97 WebView.prototype.maybeHandleContextMenu = function(e, webViewEvent) {
99 var requestId = e.requestId; 98 var requestId = e.requestId;
100 // Construct the event.menu object. 99 // Construct the event.menu object.
101 var actionTaken = false; 100 var actionTaken = false;
102 var validateCall = function() { 101 var validateCall = function() {
103 var ERROR_MSG_CONTEXT_MENU_ACTION_ALREADY_TAKEN = '<webview>: ' + 102 var ERROR_MSG_CONTEXT_MENU_ACTION_ALREADY_TAKEN = '<webview>: ' +
104 'An action has already been taken for this "contextmenu" event.'; 103 'An action has already been taken for this "contextmenu" event.';
105 104
106 if (actionTaken) { 105 if (actionTaken) {
107 throw new Error(ERROR_MSG_CONTEXT_MENU_ACTION_ALREADY_TAKEN); 106 throw new Error(ERROR_MSG_CONTEXT_MENU_ACTION_ALREADY_TAKEN);
108 } 107 }
(...skipping 17 matching lines...) Expand all
126 actionTaken = true; 125 actionTaken = true;
127 // The default action is equivalent to just showing the context menu as is. 126 // The default action is equivalent to just showing the context menu as is.
128 ChromeWebView.showContextMenu(this.guestInstanceId, requestId, undefined); 127 ChromeWebView.showContextMenu(this.guestInstanceId, requestId, undefined);
129 128
130 // TODO(lazyboy): Figure out a way to show warning message only when 129 // TODO(lazyboy): Figure out a way to show warning message only when
131 // listeners are registered for this event. 130 // listeners are registered for this event.
132 } // else we will ignore showing the context menu completely. 131 } // else we will ignore showing the context menu completely.
133 }; 132 };
134 133
135 /** @private */ 134 /** @private */
136 WebViewInternal.prototype.setupExperimentalContextMenus = function() { 135 WebView.prototype.setupExperimentalContextMenus = function() {
137 var createContextMenus = function() { 136 var createContextMenus = function() {
138 return function() { 137 return function() {
139 if (this.contextMenus_) { 138 if (this.contextMenus_) {
140 return this.contextMenus_; 139 return this.contextMenus_;
141 } 140 }
142 141
143 this.contextMenus_ = new WebViewContextMenus(this.viewInstanceId); 142 this.contextMenus_ = new WebViewContextMenus(this.viewInstanceId);
144 143
145 // Define 'onClicked' event property on |this.contextMenus_|. 144 // Define 'onClicked' event property on |this.contextMenus_|.
146 var getOnClickedEvent = function() { 145 var getOnClickedEvent = function() {
(...skipping 22 matching lines...) Expand all
169 168
170 // Expose <webview>.contextMenus object. 169 // Expose <webview>.contextMenus object.
171 Object.defineProperty( 170 Object.defineProperty(
172 this.webviewNode, 171 this.webviewNode,
173 'contextMenus', 172 'contextMenus',
174 { 173 {
175 get: createContextMenus(), 174 get: createContextMenus(),
176 enumerable: true 175 enumerable: true
177 }); 176 });
178 }; 177 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698