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

Unified Diff: chrome/browser/ui/bookmarks/bookmarks_tab_helper.cc

Issue 7013001: Rename BookmarksTabHelper to BookmarkTabHelper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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/ui/bookmarks/bookmarks_tab_helper.cc
diff --git a/chrome/browser/ui/bookmarks/bookmarks_tab_helper.cc b/chrome/browser/ui/bookmarks/bookmarks_tab_helper.cc
deleted file mode 100644
index 8053f225a86c72faba2626e290ec94a6f7467890..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/bookmarks/bookmarks_tab_helper.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 2011 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/ui/bookmarks/bookmarks_tab_helper.h"
-
-#include "chrome/browser/bookmarks/bookmark_model.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/bookmarks/bookmarks_tab_helper_delegate.h"
-#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
-#include "content/common/notification_service.h"
-
-BookmarksTabHelper::BookmarksTabHelper(TabContentsWrapper* tab_contents)
- : TabContentsObserver(tab_contents->tab_contents()),
- is_starred_(false),
- tab_contents_wrapper_(tab_contents),
- delegate_(NULL) {
- // Register for notifications about URL starredness changing on any profile.
- registrar_.Add(this, NotificationType::URLS_STARRED,
- NotificationService::AllSources());
- registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED,
- NotificationService::AllSources());
-}
-
-BookmarksTabHelper::~BookmarksTabHelper() {
- // We don't want any notifications while we're running our destructor.
- registrar_.RemoveAll();
-}
-
-void BookmarksTabHelper::DidNavigateMainFramePostCommit(
- const NavigationController::LoadCommittedDetails& /*details*/,
- const ViewHostMsg_FrameNavigate_Params& /*params*/) {
- UpdateStarredStateForCurrentURL();
-}
-
-void BookmarksTabHelper::Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details) {
- switch (type.value) {
- case NotificationType::BOOKMARK_MODEL_LOADED:
- // BookmarkModel finished loading, fall through to update starred state.
- case NotificationType::URLS_STARRED: {
- // Somewhere, a URL has been starred.
- // Ignore notifications for profiles other than our current one.
- Profile* source_profile = Source<Profile>(source).ptr();
- if (!source_profile ||
- !source_profile->IsSameProfile(tab_contents_wrapper_->profile()))
- return;
-
- UpdateStarredStateForCurrentURL();
- break;
- }
-
- default:
- NOTREACHED();
- }
-}
-
-void BookmarksTabHelper::UpdateStarredStateForCurrentURL() {
- BookmarkModel* model = tab_contents()->profile()->GetBookmarkModel();
- const bool old_state = is_starred_;
- is_starred_ = (model && model->IsBookmarked(tab_contents()->GetURL()));
-
- if (is_starred_ != old_state && delegate())
- delegate()->URLStarredChanged(tab_contents_wrapper_, is_starred_);
-}
« no previous file with comments | « chrome/browser/ui/bookmarks/bookmarks_tab_helper.h ('k') | chrome/browser/ui/bookmarks/bookmarks_tab_helper_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698