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

Side by Side Diff: chrome/browser/extensions/api/extension_action/extension_action_api.cc

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
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/extension_action/extension_action_api.h" 5 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 event_name = "pageAction.onClicked"; 229 event_name = "pageAction.onClicked";
230 break; 230 break;
231 case ActionInfo::TYPE_SYSTEM_INDICATOR: 231 case ActionInfo::TYPE_SYSTEM_INDICATOR:
232 // The System Indicator handles its own clicks. 232 // The System Indicator handles its own clicks.
233 NOTREACHED(); 233 NOTREACHED();
234 break; 234 break;
235 } 235 }
236 236
237 if (event_name) { 237 if (event_name) {
238 std::unique_ptr<base::ListValue> args(new base::ListValue()); 238 std::unique_ptr<base::ListValue> args(new base::ListValue());
239 args->Append( 239 args->Append(ExtensionTabUtil::CreateTabObject(web_contents)->ToValue());
240 ExtensionTabUtil::CreateTabObject(web_contents)->ToValue().release());
241 240
242 DispatchEventToExtension(web_contents->GetBrowserContext(), 241 DispatchEventToExtension(web_contents->GetBrowserContext(),
243 extension_action.extension_id(), histogram_value, 242 extension_action.extension_id(), histogram_value,
244 event_name, std::move(args)); 243 event_name, std::move(args));
245 } 244 }
246 } 245 }
247 246
248 void ExtensionActionAPI::ClearAllValuesForTab( 247 void ExtensionActionAPI::ClearAllValuesForTab(
249 content::WebContents* web_contents) { 248 content::WebContents* web_contents) {
250 DCHECK(web_contents); 249 DCHECK(web_contents);
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP || 630 if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP ||
632 host->extension()->id() != extension_->id()) 631 host->extension()->id() != extension_->id())
633 return; 632 return;
634 633
635 SendResponse(true); 634 SendResponse(true);
636 response_sent_ = true; 635 response_sent_ = true;
637 registrar_.RemoveAll(); 636 registrar_.RemoveAll();
638 } 637 }
639 638
640 } // namespace extensions 639 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698