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

Side by Side Diff: chrome/browser/extensions/extension_function_dispatcher.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/browser/extensions/extension_function_dispatcher.h" 5 #include "chrome/browser/extensions/extension_function_dispatcher.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 BrowserThread::PostTask(BrowserThread::UI, 56 BrowserThread::PostTask(BrowserThread::UI,
57 FROM_HERE, 57 FROM_HERE,
58 base::Bind(&LogSuccess, 58 base::Bind(&LogSuccess,
59 extension, 59 extension,
60 api_name, 60 api_name,
61 base::Passed(&args), 61 base::Passed(&args),
62 profile)); 62 profile));
63 } else { 63 } else {
64 extensions::ActivityLog* activity_log = 64 extensions::ActivityLog* activity_log =
65 extensions::ActivityLog::GetInstance(profile); 65 extensions::ActivityLog::GetInstance(profile);
66 activity_log->LogAPIAction(extension, api_name, args.get(), ""); 66 activity_log->LogAPIAction(extension, api_name, args.get(), std::string());
67 } 67 }
68 } 68 }
69 69
70 void LogFailure(const Extension* extension, 70 void LogFailure(const Extension* extension,
71 const std::string& api_name, 71 const std::string& api_name,
72 scoped_ptr<ListValue> args, 72 scoped_ptr<ListValue> args,
73 const char* reason, 73 const char* reason,
74 Profile* profile) { 74 Profile* profile) {
75 // The ActivityLog can only be accessed from the main (UI) thread. If we're 75 // The ActivityLog can only be accessed from the main (UI) thread. If we're
76 // running on the wrong thread, re-dispatch from the main thread. 76 // running on the wrong thread, re-dispatch from the main thread.
77 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 77 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
78 BrowserThread::PostTask(BrowserThread::UI, 78 BrowserThread::PostTask(BrowserThread::UI,
79 FROM_HERE, 79 FROM_HERE,
80 base::Bind(&LogFailure, 80 base::Bind(&LogFailure,
81 extension, 81 extension,
82 api_name, 82 api_name,
83 base::Passed(&args), 83 base::Passed(&args),
84 reason, 84 reason,
85 profile)); 85 profile));
86 } else { 86 } else {
87 extensions::ActivityLog* activity_log = 87 extensions::ActivityLog* activity_log =
88 extensions::ActivityLog::GetInstance(profile); 88 extensions::ActivityLog::GetInstance(profile);
89 activity_log->LogBlockedAction(extension, 89 activity_log->LogBlockedAction(
90 api_name, 90 extension, api_name, args.get(), reason, std::string());
91 args.get(),
92 reason,
93 "");
94 } 91 }
95 } 92 }
96 93
97 94
98 // Separate copy of ExtensionAPI used for IO thread extension functions. We need 95 // Separate copy of ExtensionAPI used for IO thread extension functions. We need
99 // this because ExtensionAPI has mutable data. It should be possible to remove 96 // this because ExtensionAPI has mutable data. It should be possible to remove
100 // this once all the extension APIs are updated to the feature system. 97 // this once all the extension APIs are updated to the feature system.
101 struct Static { 98 struct Static {
102 Static() 99 Static()
103 : api(extensions::ExtensionAPI::CreateWithDefaultConfiguration()) { 100 : api(extensions::ExtensionAPI::CreateWithDefaultConfiguration()) {
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 } 402 }
406 403
407 // static 404 // static
408 void ExtensionFunctionDispatcher::SendAccessDenied( 405 void ExtensionFunctionDispatcher::SendAccessDenied(
409 IPC::Sender* ipc_sender, int routing_id, int request_id) { 406 IPC::Sender* ipc_sender, int routing_id, int request_id) {
410 ListValue empty_list; 407 ListValue empty_list;
411 ipc_sender->Send(new ExtensionMsg_Response( 408 ipc_sender->Send(new ExtensionMsg_Response(
412 routing_id, request_id, false, empty_list, 409 routing_id, request_id, false, empty_list,
413 "Access to extension API denied.")); 410 "Access to extension API denied."));
414 } 411 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browsertest.cc ('k') | chrome/browser/extensions/extension_pref_value_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698