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

Side by Side Diff: chrome/browser/ui/views/infobars/confirm_infobar.cc

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 2 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/views/infobars/confirm_infobar.h" 5 #include "chrome/browser/ui/views/infobars/confirm_infobar.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 8 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
9 #include "ui/base/window_open_disposition.h" 9 #include "ui/base/window_open_disposition.h"
10 #include "ui/views/controls/button/label_button.h" 10 #include "ui/views/controls/button/label_button.h"
11 #include "ui/views/controls/label.h" 11 #include "ui/views/controls/label.h"
12 #include "ui/views/controls/link.h" 12 #include "ui/views/controls/link.h"
13 13
14 14
15 // ConfirmInfoBarDelegate ----------------------------------------------------- 15 // ConfirmInfoBarDelegate -----------------------------------------------------
16 16
17 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { 17 // static
18 return new ConfirmInfoBar(owner, this); 18 scoped_ptr<InfoBar> ConfirmInfoBarDelegate::CreateInfoBar(
19 scoped_ptr<ConfirmInfoBarDelegate> delegate) {
20 return scoped_ptr<InfoBar>(new ConfirmInfoBar(delegate.Pass()));
19 } 21 }
20 22
21 23
22 // ConfirmInfoBar ------------------------------------------------------------- 24 // ConfirmInfoBar -------------------------------------------------------------
23 25
24 ConfirmInfoBar::ConfirmInfoBar(InfoBarService* owner, 26 ConfirmInfoBar::ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate)
25 ConfirmInfoBarDelegate* delegate) 27 : InfoBarView(delegate.PassAs<InfoBarDelegate>()),
26 : InfoBarView(owner, delegate),
27 label_(NULL), 28 label_(NULL),
28 ok_button_(NULL), 29 ok_button_(NULL),
29 cancel_button_(NULL), 30 cancel_button_(NULL),
30 link_(NULL) { 31 link_(NULL) {
31 } 32 }
32 33
33 ConfirmInfoBar::~ConfirmInfoBar() { 34 ConfirmInfoBar::~ConfirmInfoBar() {
34 } 35 }
35 36
36 void ConfirmInfoBar::Layout() { 37 void ConfirmInfoBar::Layout() {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 return; // We're closing; don't call anything, it might access the owner. 130 return; // We're closing; don't call anything, it might access the owner.
130 DCHECK(link_ != NULL); 131 DCHECK(link_ != NULL);
131 DCHECK_EQ(link_, source); 132 DCHECK_EQ(link_, source);
132 if (GetDelegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags))) 133 if (GetDelegate()->LinkClicked(ui::DispositionFromEventFlags(event_flags)))
133 RemoveSelf(); 134 RemoveSelf();
134 } 135 }
135 136
136 ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() { 137 ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() {
137 return delegate()->AsConfirmInfoBarDelegate(); 138 return delegate()->AsConfirmInfoBarDelegate();
138 } 139 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698