| 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, ChromeV8Context* context) | 60 AppBindings::AppBindings(Dispatcher* dispatcher, |
| 61 : ChromeV8Extension(dispatcher, context->v8_context()), | 61 ChromeV8Context* context) |
| 62 : ChromeV8Extension(dispatcher), |
| 62 ChromeV8ExtensionHandler(context) { | 63 ChromeV8ExtensionHandler(context) { |
| 63 RouteFunction("GetIsInstalled", | 64 RouteFunction("GetIsInstalled", |
| 64 base::Bind(&AppBindings::GetIsInstalled, base::Unretained(this))); | 65 base::Bind(&AppBindings::GetIsInstalled, base::Unretained(this))); |
| 65 RouteFunction("Install", | 66 RouteFunction("Install", |
| 66 base::Bind(&AppBindings::Install, base::Unretained(this))); | 67 base::Bind(&AppBindings::Install, base::Unretained(this))); |
| 67 RouteFunction("GetDetails", | 68 RouteFunction("GetDetails", |
| 68 base::Bind(&AppBindings::GetDetails, base::Unretained(this))); | 69 base::Bind(&AppBindings::GetDetails, base::Unretained(this))); |
| 69 RouteFunction("GetDetailsForFrame", | 70 RouteFunction("GetDetailsForFrame", |
| 70 base::Bind(&AppBindings::GetDetailsForFrame, base::Unretained(this))); | 71 base::Bind(&AppBindings::GetDetailsForFrame, base::Unretained(this))); |
| 71 RouteFunction("GetAppNotifyChannel", | 72 RouteFunction("GetAppNotifyChannel", |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 v8::HandleScope handle_scope; | 273 v8::HandleScope handle_scope; |
| 273 v8::Context::Scope context_scope(context_->v8_context()); | 274 v8::Context::Scope context_scope(context_->v8_context()); |
| 274 v8::Handle<v8::Value> argv[2]; | 275 v8::Handle<v8::Value> argv[2]; |
| 275 argv[0] = v8::String::New(state.c_str()); | 276 argv[0] = v8::String::New(state.c_str()); |
| 276 argv[1] = v8::Integer::New(callback_id); | 277 argv[1] = v8::Integer::New(callback_id); |
| 277 CHECK(context_->CallChromeHiddenMethod("app.onInstallStateResponse", | 278 CHECK(context_->CallChromeHiddenMethod("app.onInstallStateResponse", |
| 278 arraysize(argv), argv, NULL)); | 279 arraysize(argv), argv, NULL)); |
| 279 } | 280 } |
| 280 | 281 |
| 281 } // namespace extensions | 282 } // namespace extensions |
| OLD | NEW |