OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/extensions/app_bindings.h" | 5 #include "chrome/renderer/extensions/app_bindings.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 return true; | 51 return true; |
52 } | 52 } |
53 | 53 |
54 const char* kMissingClientIdError = "Missing clientId parameter"; | 54 const char* kMissingClientIdError = "Missing clientId parameter"; |
55 const char* kInvalidClientIdError = "Invalid clientId"; | 55 const char* kInvalidClientIdError = "Invalid clientId"; |
56 const char* kInvalidCallbackIdError = "Invalid callbackId"; | 56 const char* kInvalidCallbackIdError = "Invalid callbackId"; |
57 | 57 |
58 } // namespace | 58 } // namespace |
59 | 59 |
60 AppBindings::AppBindings(Dispatcher* dispatcher, | 60 AppBindings::AppBindings(Dispatcher* dispatcher, ChromeV8Context* context) |
61 ChromeV8Context* context) | 61 : ChromeV8Extension(dispatcher, context->v8_context()), |
62 : ChromeV8Extension(dispatcher), | |
63 ChromeV8ExtensionHandler(context) { | 62 ChromeV8ExtensionHandler(context) { |
64 RouteFunction("GetIsInstalled", | 63 RouteFunction("GetIsInstalled", |
65 base::Bind(&AppBindings::GetIsInstalled, base::Unretained(this))); | 64 base::Bind(&AppBindings::GetIsInstalled, base::Unretained(this))); |
66 RouteFunction("Install", | 65 RouteFunction("Install", |
67 base::Bind(&AppBindings::Install, base::Unretained(this))); | 66 base::Bind(&AppBindings::Install, base::Unretained(this))); |
68 RouteFunction("GetDetails", | 67 RouteFunction("GetDetails", |
69 base::Bind(&AppBindings::GetDetails, base::Unretained(this))); | 68 base::Bind(&AppBindings::GetDetails, base::Unretained(this))); |
70 RouteFunction("GetDetailsForFrame", | 69 RouteFunction("GetDetailsForFrame", |
71 base::Bind(&AppBindings::GetDetailsForFrame, base::Unretained(this))); | 70 base::Bind(&AppBindings::GetDetailsForFrame, base::Unretained(this))); |
72 RouteFunction("GetAppNotifyChannel", | 71 RouteFunction("GetAppNotifyChannel", |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 v8::HandleScope handle_scope; | 272 v8::HandleScope handle_scope; |
274 v8::Context::Scope context_scope(context_->v8_context()); | 273 v8::Context::Scope context_scope(context_->v8_context()); |
275 v8::Handle<v8::Value> argv[2]; | 274 v8::Handle<v8::Value> argv[2]; |
276 argv[0] = v8::String::New(state.c_str()); | 275 argv[0] = v8::String::New(state.c_str()); |
277 argv[1] = v8::Integer::New(callback_id); | 276 argv[1] = v8::Integer::New(callback_id); |
278 CHECK(context_->CallChromeHiddenMethod("app.onInstallStateResponse", | 277 CHECK(context_->CallChromeHiddenMethod("app.onInstallStateResponse", |
279 arraysize(argv), argv, NULL)); | 278 arraysize(argv), argv, NULL)); |
280 } | 279 } |
281 | 280 |
282 } // namespace extensions | 281 } // namespace extensions |
OLD | NEW |