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

Side by Side Diff: chrome/browser/ui/bookmarks/bookmark_tab_helper.cc

Issue 543663002: Componentize sad_tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix url_constants.cc Created 6 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
« no previous file with comments | « chrome/browser/ui/DEPS ('k') | chrome/browser/ui/chrome_sad_tab_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bookmarks/bookmark_tab_helper.h" 5 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
6 6
7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
8 #include "chrome/browser/defaults.h" 8 #include "chrome/browser/defaults.h"
9 #include "chrome/browser/prefs/pref_service_syncable.h" 9 #include "chrome/browser/prefs/pref_service_syncable.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/search/search.h" 11 #include "chrome/browser/search/search.h"
12 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper_delegate.h" 12 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper_delegate.h"
13 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 13 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
14 #include "chrome/browser/ui/sad_tab.h"
15 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 14 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
16 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
17 #include "components/bookmarks/browser/bookmark_model.h" 16 #include "components/bookmarks/browser/bookmark_model.h"
17 #include "components/sad_tab/sad_tab.h"
18 #include "content/public/browser/navigation_entry.h" 18 #include "content/public/browser/navigation_entry.h"
19 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
20 20
21 namespace { 21 namespace {
22 22
23 bool IsNTPWebUI(content::WebContents* web_contents) { 23 bool IsNTPWebUI(content::WebContents* web_contents) {
24 content::WebUI* web_ui = NULL; 24 content::WebUI* web_ui = NULL;
25 // Use the committed entry so the bookmarks bar disappears at the same time 25 // Use the committed entry so the bookmarks bar disappears at the same time
26 // the page does. 26 // the page does.
27 if (web_contents->GetController().GetLastCommittedEntry()) 27 if (web_contents->GetController().GetLastCommittedEntry())
(...skipping 19 matching lines...) Expand all
47 47
48 BookmarkTabHelper::~BookmarkTabHelper() { 48 BookmarkTabHelper::~BookmarkTabHelper() {
49 if (bookmark_model_) 49 if (bookmark_model_)
50 bookmark_model_->RemoveObserver(this); 50 bookmark_model_->RemoveObserver(this);
51 } 51 }
52 52
53 bool BookmarkTabHelper::ShouldShowBookmarkBar() const { 53 bool BookmarkTabHelper::ShouldShowBookmarkBar() const {
54 if (web_contents()->ShowingInterstitialPage()) 54 if (web_contents()->ShowingInterstitialPage())
55 return false; 55 return false;
56 56
57 if (chrome::SadTab::ShouldShow(web_contents()->GetCrashedStatus())) 57 if (sad_tab::SadTab::ShouldShow(web_contents()->GetCrashedStatus()))
58 return false; 58 return false;
59 59
60 if (!browser_defaults::bookmarks_enabled) 60 if (!browser_defaults::bookmarks_enabled)
61 return false; 61 return false;
62 62
63 Profile* profile = 63 Profile* profile =
64 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 64 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
65 65
66 #if !defined(OS_CHROMEOS) 66 #if !defined(OS_CHROMEOS)
67 if (profile->IsGuestSession()) 67 if (profile->IsGuestSession())
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 void BookmarkTabHelper::BookmarkNodeChanged(BookmarkModel* model, 130 void BookmarkTabHelper::BookmarkNodeChanged(BookmarkModel* model,
131 const BookmarkNode* node) { 131 const BookmarkNode* node) {
132 UpdateStarredStateForCurrentURL(); 132 UpdateStarredStateForCurrentURL();
133 } 133 }
134 134
135 void BookmarkTabHelper::DidNavigateMainFrame( 135 void BookmarkTabHelper::DidNavigateMainFrame(
136 const content::LoadCommittedDetails& /*details*/, 136 const content::LoadCommittedDetails& /*details*/,
137 const content::FrameNavigateParams& /*params*/) { 137 const content::FrameNavigateParams& /*params*/) {
138 UpdateStarredStateForCurrentURL(); 138 UpdateStarredStateForCurrentURL();
139 } 139 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/DEPS ('k') | chrome/browser/ui/chrome_sad_tab_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698