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

Side by Side Diff: chrome/browser/google/google_url_tracker_map_entry.cc

Issue 11114009: Split the existing GoogleURLTrackerInfoBarDelegate into two classes (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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
Property Changes:
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/google/google_url_tracker_map_entry.h"
6
7 #include "chrome/browser/google/google_url_tracker.h"
8 #include "chrome/browser/google/google_url_tracker_infobar_delegate.h"
9 #include "chrome/browser/infobars/infobar.h"
10 #include "chrome/common/chrome_notification_types.h"
11 #include "content/public/browser/notification_details.h"
12
13
14 GoogleURLTrackerMapEntry::GoogleURLTrackerMapEntry(
15 GoogleURLTracker* google_url_tracker,
16 InfoBarTabHelper* infobar_helper,
17 const content::NotificationSource& navigation_controller_source,
18 const content::NotificationSource& web_contents_source)
19 : google_url_tracker_(google_url_tracker),
20 infobar_helper_(infobar_helper),
21 infobar_(NULL),
22 navigation_controller_source_(navigation_controller_source),
23 web_contents_source_(web_contents_source) {
24 }
25
26 GoogleURLTrackerMapEntry::~GoogleURLTrackerMapEntry() {
27 }
28
29 void GoogleURLTrackerMapEntry::Observe(
30 int type,
31 const content::NotificationSource& source,
32 const content::NotificationDetails& details) {
33 DCHECK_EQ(chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, type);
34 DCHECK_EQ(infobar_helper_, content::Source<InfoBarTabHelper>(source).ptr());
35 if (content::Details<InfoBarRemovedDetails>(details)->first == infobar_) {
36 google_url_tracker_->DeleteMapEntryForHelper(infobar_helper_);
37 // WARNING: At this point |this| has been deleted!
38 }
39 }
40
41 void GoogleURLTrackerMapEntry::SetInfoBar(
42 GoogleURLTrackerInfoBarDelegate* infobar) {
43 DCHECK(!infobar_);
44 infobar_ = infobar;
45 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED,
46 content::Source<InfoBarTabHelper>(infobar_helper_));
47 }
48
49 void GoogleURLTrackerMapEntry::Close(bool redo_search) {
50 if (infobar_)
51 infobar_->Close(redo_search);
52 else
53 google_url_tracker_->DeleteMapEntryForHelper(infobar_helper_);
54 // WARNING: At this point |this| has been deleted!
55 }
OLDNEW
« no previous file with comments | « chrome/browser/google/google_url_tracker_map_entry.h ('k') | chrome/browser/google/google_url_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698