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

Side by Side Diff: chrome/renderer/extensions/chrome_v8_context.cc

Issue 109683007: Pass a Feature* to IsAnyFeatureAvailableToContext instead of a string name. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix dumb compilation error Created 7 years 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) 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/chrome_v8_context.h" 5 #include "chrome/renderer/extensions/chrome_v8_context.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 v8::Handle<v8::Object> global = v8_context()->Global(); 90 v8::Handle<v8::Object> global = v8_context()->Global();
91 if (!web_frame_) 91 if (!web_frame_)
92 return handle_scope.Escape(function->Call(global, argc, argv)); 92 return handle_scope.Escape(function->Call(global, argc, argv));
93 return handle_scope.Escape( 93 return handle_scope.Escape(
94 v8::Local<v8::Value>(web_frame_->callFunctionEvenIfScriptDisabled( 94 v8::Local<v8::Value>(web_frame_->callFunctionEvenIfScriptDisabled(
95 function, global, argc, argv))); 95 function, global, argc, argv)));
96 } 96 }
97 97
98 bool ChromeV8Context::IsAnyFeatureAvailableToContext( 98 bool ChromeV8Context::IsAnyFeatureAvailableToContext(const Feature& api) {
99 const std::string& api_name) {
100 return ExtensionAPI::GetSharedInstance()->IsAnyFeatureAvailableToContext( 99 return ExtensionAPI::GetSharedInstance()->IsAnyFeatureAvailableToContext(
101 api_name, 100 api,
102 extension_.get(), 101 extension_.get(),
103 context_type_, 102 context_type_,
104 UserScriptSlave::GetDataSourceURLForFrame(web_frame_)); 103 UserScriptSlave::GetDataSourceURLForFrame(web_frame_));
105 } 104 }
106 105
107 Feature::Availability ChromeV8Context::GetAvailability( 106 Feature::Availability ChromeV8Context::GetAvailability(
108 const std::string& api_name) { 107 const std::string& api_name) {
109 return ExtensionAPI::GetSharedInstance()->IsAvailable(api_name, 108 return ExtensionAPI::GetSharedInstance()->IsAvailable(api_name,
110 extension_.get(), 109 extension_.get(),
111 context_type_, 110 context_type_,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // string if a validation error has occured. 154 // string if a validation error has occured.
156 if (DCHECK_IS_ON()) { 155 if (DCHECK_IS_ON()) {
157 if (!retval.IsEmpty() && !retval->IsUndefined()) { 156 if (!retval.IsEmpty() && !retval->IsUndefined()) {
158 std::string error = *v8::String::Utf8Value(retval); 157 std::string error = *v8::String::Utf8Value(retval);
159 DCHECK(false) << error; 158 DCHECK(false) << error;
160 } 159 }
161 } 160 }
162 } 161 }
163 162
164 } // namespace extensions 163 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698