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

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

Issue 79026: added windows.getWindows() and tabs.moveTab() (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 27 matching lines...) Expand all
38 ExtensionFunction* NewExtensionFunction() { 38 ExtensionFunction* NewExtensionFunction() {
39 return new T(); 39 return new T();
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_["GetWindows"] = &NewExtensionFunction<GetWindowsFunction>;
48 factories_["GetTabsForWindow"] = 49 factories_["GetTabsForWindow"] =
49 &NewExtensionFunction<GetTabsForWindowFunction>; 50 &NewExtensionFunction<GetTabsForWindowFunction>;
50 factories_["GetTab"] = &NewExtensionFunction<GetTabFunction>; 51 factories_["GetTab"] = &NewExtensionFunction<GetTabFunction>;
51 factories_["CreateTab"] = &NewExtensionFunction<CreateTabFunction>; 52 factories_["CreateTab"] = &NewExtensionFunction<CreateTabFunction>;
52 factories_["UpdateTab"] = &NewExtensionFunction<UpdateTabFunction>; 53 factories_["UpdateTab"] = &NewExtensionFunction<UpdateTabFunction>;
54 factories_["MoveTab"] = &NewExtensionFunction<MoveTabFunction>;
53 factories_["RemoveTab"] = &NewExtensionFunction<RemoveTabFunction>; 55 factories_["RemoveTab"] = &NewExtensionFunction<RemoveTabFunction>;
54 } 56 }
55 57
56 void FactoryRegistry::GetAllNames( 58 void FactoryRegistry::GetAllNames(
57 std::vector<std::string>* names) { 59 std::vector<std::string>* names) {
58 for (FactoryMap::iterator iter = factories_.begin(); iter != factories_.end(); 60 for (FactoryMap::iterator iter = factories_.begin(); iter != factories_.end();
59 ++iter) { 61 ++iter) {
60 names->push_back(iter->first); 62 names->push_back(iter->first);
61 } 63 }
62 } 64 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 111
110 void ExtensionFunctionDispatcher::SendResponse(ExtensionFunction* function) { 112 void ExtensionFunctionDispatcher::SendResponse(ExtensionFunction* function) {
111 std::string json; 113 std::string json;
112 114
113 // Some functions might not need to return any results. 115 // Some functions might not need to return any results.
114 if (function->result()) 116 if (function->result())
115 JSONWriter::Write(function->result(), false, &json); 117 JSONWriter::Write(function->result(), false, &json);
116 118
117 render_view_host_->SendExtensionResponse(function->callback_id(), json); 119 render_view_host_->SendExtensionResponse(function->callback_id(), json);
118 } 120 }
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