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

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

Issue 7648023: renderer/extensions: Return v8::False() where possible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_app_bindings.h" 5 #include "chrome/renderer/extensions/chrome_app_bindings.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } else if (name->Equals(v8::String::New("GetDetailsForFrame"))) { 95 } else if (name->Equals(v8::String::New("GetDetailsForFrame"))) {
96 return v8::FunctionTemplate::New(GetDetailsForFrame); 96 return v8::FunctionTemplate::New(GetDetailsForFrame);
97 } else { 97 } else {
98 return v8::Handle<v8::FunctionTemplate>(); 98 return v8::Handle<v8::FunctionTemplate>();
99 } 99 }
100 } 100 }
101 101
102 static v8::Handle<v8::Value> GetIsInstalled(const v8::Arguments& args) { 102 static v8::Handle<v8::Value> GetIsInstalled(const v8::Arguments& args) {
103 WebFrame* frame = WebFrame::frameForCurrentContext(); 103 WebFrame* frame = WebFrame::frameForCurrentContext();
104 if (!frame) 104 if (!frame)
105 return v8::Boolean::New(false); 105 return v8::False();
106 106
107 GURL url(frame->document().url()); 107 GURL url(frame->document().url());
108 if (url.is_empty() || 108 if (url.is_empty() ||
109 !url.is_valid() || 109 !url.is_valid() ||
110 !(url.SchemeIs("http") || url.SchemeIs("https"))) 110 !(url.SchemeIs("http") || url.SchemeIs("https")))
111 return v8::Boolean::New(false); 111 return v8::False();
112 112
113 const ::Extension* extension = 113 const ::Extension* extension =
114 extension_dispatcher_->extensions()->GetByURL(frame->document().url()); 114 extension_dispatcher_->extensions()->GetByURL(frame->document().url());
115 115
116 bool has_web_extent = extension && 116 bool has_web_extent = extension &&
117 extension_dispatcher_->IsApplicationActive(extension->id()); 117 extension_dispatcher_->IsApplicationActive(extension->id());
118 return v8::Boolean::New(has_web_extent); 118 return v8::Boolean::New(has_web_extent);
119 } 119 }
120 120
121 static v8::Handle<v8::Value> Install(const v8::Arguments& args) { 121 static v8::Handle<v8::Value> Install(const v8::Arguments& args) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 }; 180 };
181 181
182 ExtensionDispatcher* ChromeAppExtensionWrapper::extension_dispatcher_; 182 ExtensionDispatcher* ChromeAppExtensionWrapper::extension_dispatcher_;
183 183
184 v8::Extension* ChromeAppExtension::Get( 184 v8::Extension* ChromeAppExtension::Get(
185 ExtensionDispatcher* extension_dispatcher) { 185 ExtensionDispatcher* extension_dispatcher) {
186 return new ChromeAppExtensionWrapper(extension_dispatcher); 186 return new ChromeAppExtensionWrapper(extension_dispatcher);
187 } 187 }
188 188
189 } // namespace extensions_v8 189 } // namespace extensions_v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698