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

Side by Side Diff: chrome/browser/extensions/extension_function_dispatcher.cc

Issue 62178: Flesh out more extensions tab api (added removeTab, updateTab) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_tabs_module.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "chrome/browser/extensions/extension_function_dispatcher.h" 5 #include "chrome/browser/extensions/extension_function_dispatcher.h"
6 6
7 #include "base/json_reader.h" 7 #include "base/json_reader.h"
8 #include "base/json_writer.h" 8 #include "base/json_writer.h"
9 #include "base/singleton.h" 9 #include "base/singleton.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 41
42 FactoryRegistry* FactoryRegistry::instance() { 42 FactoryRegistry* FactoryRegistry::instance() {
43 return Singleton<FactoryRegistry>::get(); 43 return Singleton<FactoryRegistry>::get();
44 } 44 }
45 45
46 FactoryRegistry::FactoryRegistry() { 46 FactoryRegistry::FactoryRegistry() {
47 // Register all functions here. 47 // Register all functions here.
48 factories_["GetTabsForWindow"] = 48 factories_["GetTabsForWindow"] =
49 &NewExtensionFunction<GetTabsForWindowFunction>; 49 &NewExtensionFunction<GetTabsForWindowFunction>;
50 factories_["GetTab"] = &NewExtensionFunction<GetTabFunction>;
50 factories_["CreateTab"] = &NewExtensionFunction<CreateTabFunction>; 51 factories_["CreateTab"] = &NewExtensionFunction<CreateTabFunction>;
52 factories_["UpdateTab"] = &NewExtensionFunction<UpdateTabFunction>;
53 factories_["RemoveTab"] = &NewExtensionFunction<RemoveTabFunction>;
51 } 54 }
52 55
53 void FactoryRegistry::GetAllNames( 56 void FactoryRegistry::GetAllNames(
54 std::vector<std::string>* names) { 57 std::vector<std::string>* names) {
55 for (FactoryMap::iterator iter = factories_.begin(); iter != factories_.end(); 58 for (FactoryMap::iterator iter = factories_.begin(); iter != factories_.end();
56 ++iter) { 59 ++iter) {
57 names->push_back(iter->first); 60 names->push_back(iter->first);
58 } 61 }
59 } 62 }
60 63
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 109
107 void ExtensionFunctionDispatcher::SendResponse(ExtensionFunction* function) { 110 void ExtensionFunctionDispatcher::SendResponse(ExtensionFunction* function) {
108 std::string json; 111 std::string json;
109 112
110 // Some functions might not need to return any results. 113 // Some functions might not need to return any results.
111 if (function->result()) 114 if (function->result())
112 JSONWriter::Write(function->result(), false, &json); 115 JSONWriter::Write(function->result(), false, &json);
113 116
114 render_view_host_->SendExtensionResponse(function->callback_id(), json); 117 render_view_host_->SendExtensionResponse(function->callback_id(), json);
115 } 118 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_tabs_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698