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

Side by Side Diff: chrome/renderer/resources/extension_process_bindings.js

Issue 313001: Implement the Extension History API, v 0.1.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The chrome Authors. All rights reserved. 1 // Copyright (c) 2009 The chrome 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 script contains privileged chrome extension related javascript APIs. 5 // This script contains privileged chrome extension related javascript APIs.
6 // It is loaded by pages whose URL has the chrome-extension protocol. 6 // It is loaded by pages whose URL has the chrome-extension protocol.
7 7
8 var chrome = chrome || {}; 8 var chrome = chrome || {};
9 (function() { 9 (function() {
10 native function GetExtensionAPIDefinition(); 10 native function GetExtensionAPIDefinition();
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 227
228 // Read api definitions and setup api functions in the chrome namespace. 228 // Read api definitions and setup api functions in the chrome namespace.
229 // TODO(rafaelw): Consider defining a json schema for an api definition 229 // TODO(rafaelw): Consider defining a json schema for an api definition
230 // and validating either here, in a unit_test or both. 230 // and validating either here, in a unit_test or both.
231 // TODO(rafaelw): Handle synchronous functions. 231 // TODO(rafaelw): Handle synchronous functions.
232 // TOOD(rafaelw): Consider providing some convenient override points 232 // TOOD(rafaelw): Consider providing some convenient override points
233 // for api functions that wish to insert themselves into the call. 233 // for api functions that wish to insert themselves into the call.
234 var apiDefinitions = JSON.parse(GetExtensionAPIDefinition()); 234 var apiDefinitions = JSON.parse(GetExtensionAPIDefinition());
235 235
236 apiDefinitions.forEach(function(apiDef) { 236 apiDefinitions.forEach(function(apiDef) {
237 chrome[apiDef.namespace] = chrome[apiDef.namespace] || {}; 237 var module = chrome;
238 var module = chrome[apiDef.namespace]; 238 var namespaces = apiDef.namespace.split('.');
239 for (var index = 0, name; name = namespaces[index]; index++) {
240 module[name] = module[name] || {};
241 module = module[name];
242 };
239 243
240 // Add types to global validationTypes 244 // Add types to global validationTypes
241 if (apiDef.types) { 245 if (apiDef.types) {
242 apiDef.types.forEach(function(t) { 246 apiDef.types.forEach(function(t) {
243 chromeHidden.validationTypes.push(t); 247 chromeHidden.validationTypes.push(t);
244 }); 248 });
245 } 249 }
246 250
247 // Setup Functions. 251 // Setup Functions.
248 if (apiDef.functions) { 252 if (apiDef.functions) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 }; 415 };
412 416
413 apiFunctions["pageAction.setIcon"].handleRequest = function(details) { 417 apiFunctions["pageAction.setIcon"].handleRequest = function(details) {
414 setIconCommon(details, this.name, this.definition.parameters); 418 setIconCommon(details, this.name, this.definition.parameters);
415 }; 419 };
416 420
417 setupBrowserActionEvent(extensionId); 421 setupBrowserActionEvent(extensionId);
418 setupPageActionEvents(extensionId); 422 setupPageActionEvents(extensionId);
419 setupToolstripEvents(GetRenderViewId()); 423 setupToolstripEvents(GetRenderViewId());
420 }); 424 });
425
426 if (!chrome.experimental)
427 chrome.experimental = {};
428
429 if (!chrome.experimental.history)
430 chrome.experimental.history = {};
431
432 chrome.experimental.history.transistionType = {
433 LINK: 0,
434 TYPED: 1,
435 AUTO_BOOKMARK: 2,
436 AUTO_SUBFRAME: 3,
437 MANUAL_SUBFRAME: 4,
438 GENERATED: 5,
439 START_PAGE: 6,
440 FORM_SUBMIT: 7,
441 RELOAD: 8,
442 KEYWORD: 9,
443 KEYWORD_GENERATED: 10
444 };
421 })(); 445 })();
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | chrome/test/data/extensions/api_test/history/a.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698