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

Side by Side Diff: chrome/browser/infobars/alternate_nav_infobar_delegate.cc

Issue 11644059: Change infobar creation to use a public static Create() method on the infobar delegate classes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/infobars/alternate_nav_infobar_delegate.h" 5 #include "chrome/browser/infobars/alternate_nav_infobar_delegate.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/api/infobars/infobar_service.h" 8 #include "chrome/browser/api/infobars/infobar_service.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
11 #include "grit/theme_resources.h" 11 #include "grit/theme_resources.h"
12 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
13 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
14 14
15 // static
16 void AlternateNavInfoBarDelegate::Create(InfoBarService* infobar_service,
17 const GURL& alternate_nav_url) {
18 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
19 new AlternateNavInfoBarDelegate(infobar_service, alternate_nav_url)));
20 }
21
15 AlternateNavInfoBarDelegate::AlternateNavInfoBarDelegate( 22 AlternateNavInfoBarDelegate::AlternateNavInfoBarDelegate(
16 InfoBarService* owner, 23 InfoBarService* owner,
17 const GURL& alternate_nav_url) 24 const GURL& alternate_nav_url)
18 : InfoBarDelegate(owner), 25 : InfoBarDelegate(owner),
19 alternate_nav_url_(alternate_nav_url) { 26 alternate_nav_url_(alternate_nav_url) {
20 } 27 }
21 28
22 AlternateNavInfoBarDelegate::~AlternateNavInfoBarDelegate() { 29 AlternateNavInfoBarDelegate::~AlternateNavInfoBarDelegate() {
23 } 30 }
24 31
(...skipping 30 matching lines...) Expand all
55 } 62 }
56 63
57 gfx::Image* AlternateNavInfoBarDelegate::GetIcon() const { 64 gfx::Image* AlternateNavInfoBarDelegate::GetIcon() const {
58 return &ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( 65 return &ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(
59 IDR_INFOBAR_ALT_NAV_URL); 66 IDR_INFOBAR_ALT_NAV_URL);
60 } 67 }
61 68
62 InfoBarDelegate::Type AlternateNavInfoBarDelegate::GetInfoBarType() const { 69 InfoBarDelegate::Type AlternateNavInfoBarDelegate::GetInfoBarType() const {
63 return PAGE_ACTION_TYPE; 70 return PAGE_ACTION_TYPE;
64 } 71 }
OLDNEW
« no previous file with comments | « chrome/browser/infobars/alternate_nav_infobar_delegate.h ('k') | chrome/browser/infobars/infobar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698