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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/google/google_url_tracker_map_entry.cc
===================================================================
--- chrome/browser/google/google_url_tracker_map_entry.cc (revision 0)
+++ chrome/browser/google/google_url_tracker_map_entry.cc (working copy)
@@ -0,0 +1,55 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/google/google_url_tracker_map_entry.h"
+
+#include "chrome/browser/google/google_url_tracker.h"
+#include "chrome/browser/google/google_url_tracker_infobar_delegate.h"
+#include "chrome/browser/infobars/infobar.h"
+#include "chrome/common/chrome_notification_types.h"
+#include "content/public/browser/notification_details.h"
+
+
+GoogleURLTrackerMapEntry::GoogleURLTrackerMapEntry(
+ GoogleURLTracker* google_url_tracker,
+ InfoBarTabHelper* infobar_helper,
+ const content::NotificationSource& navigation_controller_source,
+ const content::NotificationSource& web_contents_source)
+ : google_url_tracker_(google_url_tracker),
+ infobar_helper_(infobar_helper),
+ infobar_(NULL),
+ navigation_controller_source_(navigation_controller_source),
+ web_contents_source_(web_contents_source) {
+}
+
+GoogleURLTrackerMapEntry::~GoogleURLTrackerMapEntry() {
+}
+
+void GoogleURLTrackerMapEntry::Observe(
+ int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ DCHECK_EQ(chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, type);
+ DCHECK_EQ(infobar_helper_, content::Source<InfoBarTabHelper>(source).ptr());
+ if (content::Details<InfoBarRemovedDetails>(details)->first == infobar_) {
+ google_url_tracker_->DeleteMapEntryForHelper(infobar_helper_);
+ // WARNING: At this point |this| has been deleted!
+ }
+}
+
+void GoogleURLTrackerMapEntry::SetInfoBar(
+ GoogleURLTrackerInfoBarDelegate* infobar) {
+ DCHECK(!infobar_);
+ infobar_ = infobar;
+ registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED,
+ content::Source<InfoBarTabHelper>(infobar_helper_));
+}
+
+void GoogleURLTrackerMapEntry::Close(bool redo_search) {
+ if (infobar_)
+ infobar_->Close(redo_search);
+ else
+ google_url_tracker_->DeleteMapEntryForHelper(infobar_helper_);
+ // WARNING: At this point |this| has been deleted!
+}
Property changes on: chrome/browser/google/google_url_tracker_map_entry.cc
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
« 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