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

Unified Diff: chrome/browser/cocoa/location_bar/page_action_decoration.mm

Issue 3148018: [Mac] Retain a reference within a scoped_nsobject of a Page Action's context menu. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Fixed extra retain. Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/location_bar/page_action_decoration.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/location_bar/page_action_decoration.mm
diff --git a/chrome/browser/cocoa/location_bar/page_action_decoration.mm b/chrome/browser/cocoa/location_bar/page_action_decoration.mm
index 537b9c96b7f4000925f73554519cdd7c73e2fa94..d306d87860ee8d8e05e77057be5a4ea97200d1b8 100644
--- a/chrome/browser/cocoa/location_bar/page_action_decoration.mm
+++ b/chrome/browser/cocoa/location_bar/page_action_decoration.mm
@@ -38,6 +38,7 @@ PageActionDecoration::PageActionDecoration(
tracker_(this),
current_tab_id_(-1),
preview_enabled_(false) {
+ DCHECK(profile);
Extension* extension = profile->GetExtensionsService()->GetExtensionById(
page_action->extension_id(), false);
DCHECK(extension);
@@ -60,8 +61,7 @@ PageActionDecoration::PageActionDecoration(
Source<Profile>(profile_));
}
-PageActionDecoration::~PageActionDecoration() {
-}
+PageActionDecoration::~PageActionDecoration() {}
// Always |kPageActionIconMaxSize| wide. |ImageDecoration| draws the
// image centered.
@@ -219,10 +219,12 @@ NSMenu* PageActionDecoration::GetMenu() {
DCHECK(extension);
if (!extension)
return nil;
- return [[[ExtensionActionContextMenu alloc]
- initWithExtension:extension
- profile:profile_
- extensionAction:page_action_] autorelease];
+ menu_.reset([[ExtensionActionContextMenu alloc]
+ initWithExtension:extension
+ profile:profile_
+ extensionAction:page_action_]);
+
+ return menu_.get();
}
void PageActionDecoration::Observe(
« no previous file with comments | « chrome/browser/cocoa/location_bar/page_action_decoration.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698