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

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

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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
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/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 void ChromeV8Context::Invalidate() { 56 void ChromeV8Context::Invalidate() {
57 if (v8_context_.get().IsEmpty()) 57 if (v8_context_.get().IsEmpty())
58 return; 58 return;
59 if (module_system_) 59 if (module_system_)
60 module_system_->Invalidate(); 60 module_system_->Invalidate();
61 web_frame_ = NULL; 61 web_frame_ = NULL;
62 v8_context_.reset(); 62 v8_context_.reset();
63 } 63 }
64 64
65 std::string ChromeV8Context::GetExtensionID() { 65 std::string ChromeV8Context::GetExtensionID() {
66 return extension_ ? extension_->id() : ""; 66 return extension_ ? extension_->id() : std::string();
67 } 67 }
68 68
69 // static 69 // static
70 v8::Handle<v8::Value> ChromeV8Context::GetOrCreateChromeHidden( 70 v8::Handle<v8::Value> ChromeV8Context::GetOrCreateChromeHidden(
71 v8::Handle<v8::Context> context) { 71 v8::Handle<v8::Context> context) {
72 v8::Local<v8::Object> global = context->Global(); 72 v8::Local<v8::Object> global = context->Global();
73 v8::Local<v8::Value> hidden = global->GetHiddenValue( 73 v8::Local<v8::Value> hidden = global->GetHiddenValue(
74 v8::String::New(kChromeHidden)); 74 v8::String::New(kChromeHidden));
75 75
76 if (hidden.IsEmpty() || hidden->IsUndefined()) { 76 if (hidden.IsEmpty() || hidden->IsUndefined()) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 std::string ChromeV8Context::GetContextTypeDescription() { 181 std::string ChromeV8Context::GetContextTypeDescription() {
182 switch (context_type_) { 182 switch (context_type_) {
183 case Feature::UNSPECIFIED_CONTEXT: return "UNSPECIFIED"; 183 case Feature::UNSPECIFIED_CONTEXT: return "UNSPECIFIED";
184 case Feature::BLESSED_EXTENSION_CONTEXT: return "BLESSED_EXTENSION"; 184 case Feature::BLESSED_EXTENSION_CONTEXT: return "BLESSED_EXTENSION";
185 case Feature::UNBLESSED_EXTENSION_CONTEXT: return "UNBLESSED_EXTENSION"; 185 case Feature::UNBLESSED_EXTENSION_CONTEXT: return "UNBLESSED_EXTENSION";
186 case Feature::CONTENT_SCRIPT_CONTEXT: return "CONTENT_SCRIPT"; 186 case Feature::CONTENT_SCRIPT_CONTEXT: return "CONTENT_SCRIPT";
187 case Feature::WEB_PAGE_CONTEXT: return "WEB_PAGE"; 187 case Feature::WEB_PAGE_CONTEXT: return "WEB_PAGE";
188 } 188 }
189 NOTREACHED(); 189 NOTREACHED();
190 return ""; 190 return std::string();
191 } 191 }
192 192
193 ChromeV8Context* ChromeV8Context::GetContext() { 193 ChromeV8Context* ChromeV8Context::GetContext() {
194 return this; 194 return this;
195 } 195 }
196 196
197 void ChromeV8Context::OnResponseReceived(const std::string& name, 197 void ChromeV8Context::OnResponseReceived(const std::string& name,
198 int request_id, 198 int request_id,
199 bool success, 199 bool success,
200 const base::ListValue& response, 200 const base::ListValue& response,
(...skipping 16 matching lines...) Expand all
217 // string if a validation error has occured. 217 // string if a validation error has occured.
218 if (DCHECK_IS_ON()) { 218 if (DCHECK_IS_ON()) {
219 if (!retval.IsEmpty() && !retval->IsUndefined()) { 219 if (!retval.IsEmpty() && !retval->IsUndefined()) {
220 std::string error = *v8::String::AsciiValue(retval); 220 std::string error = *v8::String::AsciiValue(retval);
221 DCHECK(false) << error; 221 DCHECK(false) << error;
222 } 222 }
223 } 223 }
224 } 224 }
225 225
226 } // namespace extensions 226 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/content_settings_observer_browsertest.cc ('k') | chrome/renderer/extensions/extension_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698