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

Side by Side Diff: chrome/browser/extensions/extension_function_dispatcher.cc

Issue 16915006: Convert most of extensions and some other random stuff to using the base namespace for Values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_string_value_serializer.h" 8 #include "base/json/json_string_value_serializer.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 30 matching lines...) Expand all
41 41
42 using extensions::Extension; 42 using extensions::Extension;
43 using extensions::ExtensionAPI; 43 using extensions::ExtensionAPI;
44 using content::RenderViewHost; 44 using content::RenderViewHost;
45 using WebKit::WebSecurityOrigin; 45 using WebKit::WebSecurityOrigin;
46 46
47 namespace { 47 namespace {
48 48
49 void LogSuccess(const std::string& extension_id, 49 void LogSuccess(const std::string& extension_id,
50 const std::string& api_name, 50 const std::string& api_name,
51 scoped_ptr<ListValue> args, 51 scoped_ptr<base::ListValue> args,
52 Profile* profile) { 52 Profile* profile) {
53 // The ActivityLog can only be accessed from the main (UI) thread. If we're 53 // The ActivityLog can only be accessed from the main (UI) thread. If we're
54 // running on the wrong thread, re-dispatch from the main thread. 54 // running on the wrong thread, re-dispatch from the main thread.
55 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 55 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
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_id, 59 extension_id,
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( 66 activity_log->LogAPIAction(
67 extension_id, api_name, args.get(), std::string()); 67 extension_id, api_name, args.get(), std::string());
68 } 68 }
69 } 69 }
70 70
71 void LogFailure(const std::string& extension_id, 71 void LogFailure(const std::string& extension_id,
72 const std::string& api_name, 72 const std::string& api_name,
73 scoped_ptr<ListValue> args, 73 scoped_ptr<base::ListValue> args,
74 extensions::BlockedAction::Reason reason, 74 extensions::BlockedAction::Reason reason,
75 Profile* profile) { 75 Profile* profile) {
76 // The ActivityLog can only be accessed from the main (UI) thread. If we're 76 // The ActivityLog can only be accessed from the main (UI) thread. If we're
77 // running on the wrong thread, re-dispatch from the main thread. 77 // running on the wrong thread, re-dispatch from the main thread.
78 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 78 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
79 BrowserThread::PostTask(BrowserThread::UI, 79 BrowserThread::PostTask(BrowserThread::UI,
80 FROM_HERE, 80 FROM_HERE,
81 base::Bind(&LogFailure, 81 base::Bind(&LogFailure,
82 extension_id, 82 extension_id,
83 api_name, 83 api_name,
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 return function; 532 return function;
533 } 533 }
534 534
535 // static 535 // static
536 void ExtensionFunctionDispatcher::SendAccessDenied( 536 void ExtensionFunctionDispatcher::SendAccessDenied(
537 const ExtensionFunction::ResponseCallback& callback) { 537 const ExtensionFunction::ResponseCallback& callback) {
538 ListValue empty_list; 538 ListValue empty_list;
539 callback.Run(ExtensionFunction::FAILED, empty_list, 539 callback.Run(ExtensionFunction::FAILED, empty_list,
540 "Access to extension API denied."); 540 "Access to extension API denied.");
541 } 541 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698