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

Side by Side Diff: chrome/browser/extensions/api/declarative/declarative_api.cc

Issue 16295003: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased 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/api/declarative/declarative_api.h" 5 #include "chrome/browser/extensions/api/declarative/declarative_api.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/task_runner_util.h" 9 #include "base/task_runner_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 24 matching lines...) Expand all
35 bool RulesFunction::RunImpl() { 35 bool RulesFunction::RunImpl() {
36 std::string event_name; 36 std::string event_name;
37 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &event_name)); 37 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &event_name));
38 38
39 RulesRegistryService* rules_registry_service = 39 RulesRegistryService* rules_registry_service =
40 ExtensionSystemFactory::GetForProfile(profile())-> 40 ExtensionSystemFactory::GetForProfile(profile())->
41 rules_registry_service(); 41 rules_registry_service();
42 rules_registry_ = rules_registry_service->GetRulesRegistry(event_name); 42 rules_registry_ = rules_registry_service->GetRulesRegistry(event_name);
43 // Raw access to this function is not available to extensions, therefore 43 // Raw access to this function is not available to extensions, therefore
44 // there should never be a request for a nonexisting rules registry. 44 // there should never be a request for a nonexisting rules registry.
45 EXTENSION_FUNCTION_VALIDATE(rules_registry_); 45 EXTENSION_FUNCTION_VALIDATE(rules_registry_.get());
46 46
47 if (content::BrowserThread::CurrentlyOn(rules_registry_->owner_thread())) { 47 if (content::BrowserThread::CurrentlyOn(rules_registry_->owner_thread())) {
48 bool success = RunImplOnCorrectThread(); 48 bool success = RunImplOnCorrectThread();
49 SendResponse(success); 49 SendResponse(success);
50 } else { 50 } else {
51 scoped_refptr<base::MessageLoopProxy> message_loop_proxy = 51 scoped_refptr<base::MessageLoopProxy> message_loop_proxy =
52 content::BrowserThread::GetMessageLoopProxyForThread( 52 content::BrowserThread::GetMessageLoopProxyForThread(
53 rules_registry_->owner_thread()); 53 rules_registry_->owner_thread());
54 base::PostTaskAndReplyWithResult( 54 base::PostTaskAndReplyWithResult(
55 message_loop_proxy, 55 message_loop_proxy.get(),
56 FROM_HERE, 56 FROM_HERE,
57 base::Bind(&RulesFunction::RunImplOnCorrectThread, this), 57 base::Bind(&RulesFunction::RunImplOnCorrectThread, this),
58 base::Bind(&RulesFunction::SendResponse, this)); 58 base::Bind(&RulesFunction::SendResponse, this));
59 } 59 }
60 60
61 return true; 61 return true;
62 } 62 }
63 63
64 bool EventsEventAddRulesFunction::RunImplOnCorrectThread() { 64 bool EventsEventAddRulesFunction::RunImplOnCorrectThread() {
65 scoped_ptr<AddRules::Params> params(AddRules::Params::Create(*args_)); 65 scoped_ptr<AddRules::Params> params(AddRules::Params::Create(*args_));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 error_ = rules_registry_->GetAllRules(extension_id(), &rules); 100 error_ = rules_registry_->GetAllRules(extension_id(), &rules);
101 } 101 }
102 102
103 if (error_.empty()) 103 if (error_.empty())
104 results_ = GetRules::Results::Create(rules); 104 results_ = GetRules::Results::Create(rules);
105 105
106 return error_.empty(); 106 return error_.empty();
107 } 107 }
108 108
109 } // namespace extensions 109 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698