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

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

Issue 79070: createWindow api call. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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
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/process_util.h" 9 #include "base/process_util.h"
10 #include "base/singleton.h" 10 #include "base/singleton.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 FactoryRegistry* FactoryRegistry::instance() { 46 FactoryRegistry* FactoryRegistry::instance() {
47 return Singleton<FactoryRegistry>::get(); 47 return Singleton<FactoryRegistry>::get();
48 } 48 }
49 49
50 FactoryRegistry::FactoryRegistry() { 50 FactoryRegistry::FactoryRegistry() {
51 // Register all functions here. 51 // Register all functions here.
52 52
53 // Tabs 53 // Tabs
54 factories_["GetWindows"] = &NewExtensionFunction<GetWindowsFunction>; 54 factories_["GetWindows"] = &NewExtensionFunction<GetWindowsFunction>;
55 factories_["CreateWindow"] = &NewExtensionFunction<CreateWindowFunction>;
55 factories_["GetTabsForWindow"] = 56 factories_["GetTabsForWindow"] =
56 &NewExtensionFunction<GetTabsForWindowFunction>; 57 &NewExtensionFunction<GetTabsForWindowFunction>;
57 factories_["GetTab"] = &NewExtensionFunction<GetTabFunction>; 58 factories_["GetTab"] = &NewExtensionFunction<GetTabFunction>;
58 factories_["CreateTab"] = &NewExtensionFunction<CreateTabFunction>; 59 factories_["CreateTab"] = &NewExtensionFunction<CreateTabFunction>;
59 factories_["UpdateTab"] = &NewExtensionFunction<UpdateTabFunction>; 60 factories_["UpdateTab"] = &NewExtensionFunction<UpdateTabFunction>;
60 factories_["MoveTab"] = &NewExtensionFunction<MoveTabFunction>; 61 factories_["MoveTab"] = &NewExtensionFunction<MoveTabFunction>;
61 factories_["RemoveTab"] = &NewExtensionFunction<RemoveTabFunction>; 62 factories_["RemoveTab"] = &NewExtensionFunction<RemoveTabFunction>;
62 63
63 // Bookmarks 64 // Bookmarks
64 factories_["GetBookmarks"] = &NewExtensionFunction<GetBookmarksFunction>; 65 factories_["GetBookmarks"] = &NewExtensionFunction<GetBookmarksFunction>;
(...skipping 25 matching lines...) Expand all
90 91
91 // ExtensionFunctionDispatcher ------------------------------------------------- 92 // ExtensionFunctionDispatcher -------------------------------------------------
92 93
93 void ExtensionFunctionDispatcher::GetAllFunctionNames( 94 void ExtensionFunctionDispatcher::GetAllFunctionNames(
94 std::vector<std::string>* names) { 95 std::vector<std::string>* names) {
95 FactoryRegistry::instance()->GetAllNames(names); 96 FactoryRegistry::instance()->GetAllNames(names);
96 } 97 }
97 98
98 ExtensionFunctionDispatcher::ExtensionFunctionDispatcher( 99 ExtensionFunctionDispatcher::ExtensionFunctionDispatcher(
99 RenderViewHost* render_view_host, 100 RenderViewHost* render_view_host,
101 Browser* browser,
100 const std::string& extension_id) 102 const std::string& extension_id)
101 : render_view_host_(render_view_host), 103 : render_view_host_(render_view_host),
104 browser_(browser),
102 extension_id_(extension_id) { 105 extension_id_(extension_id) {
103 } 106 }
104 107
105 void ExtensionFunctionDispatcher::HandleRequest(const std::string& name, 108 void ExtensionFunctionDispatcher::HandleRequest(const std::string& name,
106 const std::string& args, 109 const std::string& args,
107 int callback_id) { 110 int callback_id) {
108 scoped_ptr<Value> value; 111 scoped_ptr<Value> value;
109 if (!args.empty()) { 112 if (!args.empty()) {
110 JSONReader reader; 113 JSONReader reader;
111 value.reset(reader.JsonToValue(args, false, false)); 114 value.reset(reader.JsonToValue(args, false, false));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } else { 150 } else {
148 NOTREACHED(); 151 NOTREACHED();
149 base::KillProcess(render_view_host_->process()->process().handle(), 152 base::KillProcess(render_view_host_->process()->process().handle(),
150 ResultCodes::KILLED_BAD_MESSAGE, false); 153 ResultCodes::KILLED_BAD_MESSAGE, false);
151 } 154 }
152 } 155 }
153 156
154 Profile* ExtensionFunctionDispatcher::profile() { 157 Profile* ExtensionFunctionDispatcher::profile() {
155 return render_view_host_->process()->profile(); 158 return render_view_host_->process()->profile();
156 } 159 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_function_dispatcher.h ('k') | chrome/browser/extensions/extension_tabs_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698