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/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 namespace { | 33 namespace { |
34 | 34 |
35 bool IsCheckoutURL(const std::string& url_spec) { | 35 bool IsCheckoutURL(const std::string& url_spec) { |
36 std::string checkout_url_prefix = | 36 std::string checkout_url_prefix = |
37 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 37 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
38 switches::kAppsCheckoutURL); | 38 switches::kAppsCheckoutURL); |
39 if (checkout_url_prefix.empty()) | 39 if (checkout_url_prefix.empty()) |
40 checkout_url_prefix = "https://checkout.google.com/"; | 40 checkout_url_prefix = "https://checkout.google.com/"; |
41 | 41 |
42 return base::StartsWithASCII(url_spec, checkout_url_prefix, false); | 42 return base::StartsWith(url_spec, checkout_url_prefix, |
| 43 base::CompareCase::INSENSITIVE_ASCII); |
43 } | 44 } |
44 | 45 |
45 bool CheckAccessToAppDetails(WebFrame* frame, v8::Isolate* isolate) { | 46 bool CheckAccessToAppDetails(WebFrame* frame, v8::Isolate* isolate) { |
46 if (!IsCheckoutURL(frame->document().url().spec())) { | 47 if (!IsCheckoutURL(frame->document().url().spec())) { |
47 std::string error("Access denied for URL: "); | 48 std::string error("Access denied for URL: "); |
48 error += frame->document().url().spec(); | 49 error += frame->document().url().spec(); |
49 isolate->ThrowException(v8::String::NewFromUtf8(isolate, error.c_str())); | 50 isolate->ThrowException(v8::String::NewFromUtf8(isolate, error.c_str())); |
50 return false; | 51 return false; |
51 } | 52 } |
52 | 53 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 v8::Context::Scope context_scope(context()->v8_context()); | 221 v8::Context::Scope context_scope(context()->v8_context()); |
221 v8::Local<v8::Value> argv[] = { | 222 v8::Local<v8::Value> argv[] = { |
222 v8::String::NewFromUtf8(isolate, state.c_str()), | 223 v8::String::NewFromUtf8(isolate, state.c_str()), |
223 v8::Integer::New(isolate, callback_id) | 224 v8::Integer::New(isolate, callback_id) |
224 }; | 225 }; |
225 context()->module_system()->CallModuleMethod( | 226 context()->module_system()->CallModuleMethod( |
226 "app", "onInstallStateResponse", arraysize(argv), argv); | 227 "app", "onInstallStateResponse", arraysize(argv), argv); |
227 } | 228 } |
228 | 229 |
229 } // namespace extensions | 230 } // namespace extensions |
OLD | NEW |