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

Side by Side Diff: chrome/browser/ui/cocoa/keystone_infobar_delegate.mm

Issue 10534093: TabContentsWrapper -> TabContents, part 37. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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/ui/cocoa/keystone_infobar_delegate.h" 5 #include "chrome/browser/ui/cocoa/keystone_infobar_delegate.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "chrome/browser/first_run/first_run.h" 15 #include "chrome/browser/first_run/first_run.h"
16 #include "chrome/browser/infobars/infobar_tab_helper.h" 16 #include "chrome/browser/infobars/infobar_tab_helper.h"
17 #import "chrome/browser/mac/keystone_glue.h" 17 #import "chrome/browser/mac/keystone_glue.h"
18 #include "chrome/browser/prefs/pref_service.h" 18 #include "chrome/browser/prefs/pref_service.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" 20 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
21 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
22 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" 22 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h"
23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 23 #include "chrome/browser/ui/tab_contents/tab_contents.h"
24 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
25 #include "chrome/common/pref_names.h" 25 #include "chrome/common/pref_names.h"
26 #include "content/public/browser/navigation_details.h" 26 #include "content/public/browser/navigation_details.h"
27 #include "grit/chromium_strings.h" 27 #include "grit/chromium_strings.h"
28 #include "grit/generated_resources.h" 28 #include "grit/generated_resources.h"
29 #include "grit/theme_resources.h" 29 #include "grit/theme_resources.h"
30 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
31 #include "ui/base/resource/resource_bundle.h" 31 #include "ui/base/resource/resource_bundle.h"
32 32
33 class SkBitmap; 33 class SkBitmap;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 if (status == kAutoupdateNone || status == kAutoupdateRegistering) { 184 if (status == kAutoupdateNone || status == kAutoupdateRegistering) {
185 return; 185 return;
186 } 186 }
187 187
188 [self removeObserver]; 188 [self removeObserver];
189 189
190 if (status != kAutoupdateRegisterFailed && 190 if (status != kAutoupdateRegisterFailed &&
191 [[KeystoneGlue defaultKeystoneGlue] needsPromotion]) { 191 [[KeystoneGlue defaultKeystoneGlue] needsPromotion]) {
192 Browser* browser = browser::GetLastActiveBrowser(); 192 Browser* browser = browser::GetLastActiveBrowser();
193 if (browser) { 193 if (browser) {
194 TabContentsWrapper* wrapper = browser->GetSelectedTabContentsWrapper(); 194 TabContents* tabContents = browser->GetActiveTabContents();
195 195
196 // Only show if no other info bars are showing, because that's how the 196 // Only show if no other info bars are showing, because that's how the
197 // default browser info bar works. 197 // default browser info bar works.
198 if (wrapper) { 198 if (tabContents) {
199 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); 199 InfoBarTabHelper* infobar_helper = tabContents->infobar_tab_helper();
200 if (infobar_helper->infobar_count() == 0) { 200 if (infobar_helper->infobar_count() == 0) {
201 infobar_helper->AddInfoBar( 201 infobar_helper->AddInfoBar(
202 new KeystonePromotionInfoBarDelegate( 202 new KeystonePromotionInfoBarDelegate(
203 infobar_helper, 203 infobar_helper,
204 wrapper->profile()->GetPrefs())); 204 tabContents->profile()->GetPrefs()));
205 } 205 }
206 } 206 }
207 } 207 }
208 } 208 }
209 209
210 [self release]; 210 [self release];
211 } 211 }
212 212
213 - (void)removeObserver { 213 - (void)removeObserver {
214 [[NSNotificationCenter defaultCenter] removeObserver:self]; 214 [[NSNotificationCenter defaultCenter] removeObserver:self];
215 } 215 }
216 216
217 @end // @implementation KeystonePromotionInfoBar 217 @end // @implementation KeystonePromotionInfoBar
218 218
219 // static 219 // static
220 void KeystoneInfoBar::PromotionInfoBar(Profile* profile) { 220 void KeystoneInfoBar::PromotionInfoBar(Profile* profile) {
221 KeystonePromotionInfoBar* promotionInfoBar = 221 KeystonePromotionInfoBar* promotionInfoBar =
222 [[[KeystonePromotionInfoBar alloc] init] autorelease]; 222 [[[KeystonePromotionInfoBar alloc] init] autorelease];
223 223
224 [promotionInfoBar checkAndShowInfoBarForProfile:profile]; 224 [promotionInfoBar checkAndShowInfoBarForProfile:profile];
225 } 225 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698