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

Unified Diff: chrome/browser/google/google_url_tracker_map_entry.cc

Issue 316203003: Componentize GoogleURLTracker(InfoBarDelegate,MapEntry,NavHelper) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/google/google_url_tracker_map_entry.cc
diff --git a/chrome/browser/google/google_url_tracker_map_entry.cc b/chrome/browser/google/google_url_tracker_map_entry.cc
deleted file mode 100644
index f994f299297abb5b4fecf64366fa6f0b5965f685..0000000000000000000000000000000000000000
--- a/chrome/browser/google/google_url_tracker_map_entry.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 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/chrome_notification_types.h"
-#include "chrome/browser/google/google_url_tracker.h"
-#include "components/infobars/core/infobar.h"
-
-GoogleURLTrackerMapEntry::GoogleURLTrackerMapEntry(
- GoogleURLTracker* google_url_tracker,
- infobars::InfoBarManager* infobar_manager,
- scoped_ptr<GoogleURLTrackerNavigationHelper> navigation_helper)
- : google_url_tracker_(google_url_tracker),
- infobar_manager_(infobar_manager),
- infobar_delegate_(NULL),
- navigation_helper_(navigation_helper.Pass()),
- observing_(false) {
- DCHECK(infobar_manager_);
-}
-
-GoogleURLTrackerMapEntry::~GoogleURLTrackerMapEntry() {
- if (observing_)
- infobar_manager_->RemoveObserver(this);
-}
-
-void GoogleURLTrackerMapEntry::SetInfoBarDelegate(
- GoogleURLTrackerInfoBarDelegate* infobar_delegate) {
- DCHECK(!infobar_delegate_);
-
- // Transfer ownership of |navigation_helper_| to the infobar delegate as the
- // infobar delegate has need of it after this object has been destroyed in
- // the case where the user accepts the new Google URL.
- infobar_delegate->set_navigation_helper(navigation_helper_.Pass());
- infobar_delegate_ = infobar_delegate;
- infobar_manager_->AddObserver(this);
- observing_ = true;
-}
-
-void GoogleURLTrackerMapEntry::Close(bool redo_search) {
- if (infobar_delegate_) {
- infobar_delegate_->Close(redo_search);
- } else {
- // WARNING: |infobar_manager_| may point to a deleted object. Do not
- // dereference it! See GoogleURLTracker::OnTabClosed().
- google_url_tracker_->DeleteMapEntryForManager(infobar_manager_);
- }
- // WARNING: At this point |this| has been deleted!
-}
-
-void GoogleURLTrackerMapEntry::OnInfoBarRemoved(infobars::InfoBar* infobar,
- bool animate) {
- DCHECK(infobar_delegate_);
- if (infobar->delegate() == infobar_delegate_) {
- google_url_tracker_->DeleteMapEntryForManager(infobar_manager_);
- // WARNING: At this point |this| has been deleted!
- }
-}
-
-void GoogleURLTrackerMapEntry::OnManagerShuttingDown(
- infobars::InfoBarManager* manager) {
- DCHECK(observing_);
- DCHECK_EQ(infobar_manager_, manager);
- manager->RemoveObserver(this);
- observing_ = false;
-}
« no previous file with comments | « chrome/browser/google/google_url_tracker_map_entry.h ('k') | chrome/browser/google/google_url_tracker_navigation_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698