Creating Google Chrome Extensions(Apress2016) Chrome扩展开发教程英文版 0分
Creating Google Chrome Extensions Prateek Mehta New Delhi, India ISBN-13(pbk:978-1-4842-1714-0 ISBN-13( electronic:978-1-4842-1775-7 DOI10.1007/978-1-4842-1775-7 Library of Congress Control Number: 2016943479 Copyright o 2016 by Prateek Mehta This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed Exempted from this legal reservation are brief excerpts in connection with reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher's location, in its current version, and permission for use must always be obtained from Springer. Permissions for use may be obtained through Rights Link at the Copyright Clearance Center Violations are liable to prosecution under the respective Copyright Law Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein Managing Director: Welmoed Spahr Acquisitions Editor: Ben Renow-Clarke Development Editor: Matthew Moodie Technical reviewer: Massimo nardone Editorial Board: Steve Anglin, Pramila Balen, Louise Corrigan, James De Wolf, Jonathan Gennick, Robert Hutchinson, Celestin Suresh John, Nikhil Karkal James Markham, Susan McDermott, Matthew Moodie, Douglas Pundick Ben Renow-Clarke, Gwenan Spearing Coordinating Editor: Nancy Chen Copy Editor: Kezia Endsley Compositor: SPi Global Indexer: SPi Global Artist: SPi Global Distributed to the book trade worldwide by Springer Science+ Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201)348-4505 e-mailorders-ny@springer-sbm.com,orvisitwww.springer.comApressMedia,LlcisaCalifornia LLC and the sole member(owner )is Springer Science+ Business Media Finance Inc(SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation Forinformationontranslationspleasee-mailrights@apress.comorvisitwww.apress.com Apress and friends of ed books may be purchased in bulk for academic, corporate, or promotional use e Book versions and licenses are also available for most titles For more information reference ourSpecialBulkSales-ebookLicensingwebpageatwww.apress.com/bulk-sales Any source code or other supplementary materials referenced by the author in this text is available to eadersatwww.apress.com.Fordetailedinformationabouthowtolocateyourbookssourcecodego towww.apress.com/source-code/ Printed on acid-free paper Dedicated to my parents and my brother for their everlasting support and encouragement. And to the stack Overflow community, for making computer programming less troublesome Contents at a Glance About the author ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■國■■■■■■■■■■■國■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ XI About the technical reviewer ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■■口■■■■■■■■■■■国■■国■■■■■口■ Acknowledgments ammmaaamammaamaaaaaaaaaeasaaseaseannaananmmmaamaamamnan. XV Introduction ■■■■■■圆■■固■■■■■固国■国题 Chapter 1: Introduction to Google Chrome Extensions Chapter 2: Architecture Overview 1■■■■■■■■I 35 Chapter 3: API Availability and Messaging ammmmmmmmmn 79 Chapter 4: More About Extensions ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■国■■■■■■■■ 145 Index 163 Contents About the author ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■國■■■■■■■■■■■國■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ XI About the technical reviewer ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■■口■■■■■■■■■■■国■■国■■■■■口■ Acknowledgments ammmaaamammaamaaaaaaaaaeasaaseaseannaananmmmaamaamamnan. XV Introduction ■■■■■■圆■■固■■■■■固国■国题 Chapter 1: Introduction to Google Chrome Extensions What are Google chrome EXtensions? Support for browser Extensions.. EXtensions Are Not Plug-ins........,.,.,.,... 2 Extensions and plug-ins. ............................3 Notable Examples Adding Extensions from the Store Technologies to create Extensions How Are Technologies Used? 8 Extensions ap|,......... Creating Your First EXtension. 9 Validating a json File. Creating the Manifes 12 Adding the Button CONTENTS Loading the Extension Folder 15 Debugging an EXtension 17 Inspecting the Popup 18 Sources and resources pane...... 19 Console panel Distributing on Store 22 Summary 33 Chapter 2: Architecture Overview ammmmmmmmmm 35 What Is User perspective? 35 Components Involved in Creating Chrome Extensions............35 Extension runtime 40 Scripts Representing the Runtime. Input components: Part One The Browser-Action and Page -Action Components. 42 Shortcut Key or command Event Scripts ,50 The Need for Event Scripts.. 日日日自日自日日面日 51 Role of the Manifest for This component 53 Event objects Revisiting the on Command event . Declarative event handlers 57 Content scripts.. .62 Role of the Manifest for this component HelloContentscript EXtension................................ 65 EXamples of Components 68 BrowserAction Notes extension PageActionNotes Extension 74 Summary 77 CONTENTS Chapter 3: API Availability and Messaging mmmm 79 Input Components: Part TWO.eaeeeeeeeeenn 79 Omnibox Inputs 79 Context menu items.wwwwwww 85 Revisiting Content-UI 90 Messaging for communication ,94 APIs and Events 95 Web Page Scripts and Event Scripts 96 Content Scripts and Event Scripts.............. 103 Popup Scripts and Event Scripts 115 Google Chrome Extensions APIs 117 Declare permissions 118 Alarms APl 121 Bookmarks apl 124 Downloads apl History APl 132 Notifications apl Storage AP Tabs APl XHR API 142 Summary................,,144 Chapter 4: More About Extensions 145 Providing an Options page . eeeeeee 145 Role of Manifest for this component 145 Writing an Options Page Working with Override Pagesmmamnatannanatann, 149 Role of Manifest for this component 151 OverridePages Extension 151
下载地址
用户评论