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

Side by Side Diff: chrome/browser/favicon/favicon_helper.cc

Issue 1208963003: Move GN obj files to target-specific dirs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: \ Created 5 years, 5 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/favicon/favicon_helper.h ('k') | chrome/browser/favicon/favicon_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/favicon/favicon_helper.h"
6
7 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
8 #include "chrome/browser/favicon/favicon_service_factory.h"
9 #include "chrome/browser/history/history_service_factory.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/search/search.h"
12 #include "chrome/common/url_constants.h"
13 #include "content/public/common/favicon_url.h"
14
15 namespace favicon {
16
17 void CreateContentFaviconDriverForWebContents(
18 content::WebContents* web_contents) {
19 DCHECK(web_contents);
20 if (ContentFaviconDriver::FromWebContents(web_contents))
21 return;
22
23 Profile* original_profile =
24 Profile::FromBrowserContext(web_contents->GetBrowserContext())
25 ->GetOriginalProfile();
26 return ContentFaviconDriver::CreateForWebContents(
27 web_contents, FaviconServiceFactory::GetForProfile(
28 original_profile, ServiceAccessType::IMPLICIT_ACCESS),
29 HistoryServiceFactory::GetForProfile(original_profile,
30 ServiceAccessType::IMPLICIT_ACCESS),
31 BookmarkModelFactory::GetForProfileIfExists(original_profile));
32 }
33
34 bool ShouldDisplayFavicon(content::WebContents* web_contents) {
35 // Always display a throbber during pending loads.
36 const content::NavigationController& controller =
37 web_contents->GetController();
38 if (controller.GetLastCommittedEntry() && controller.GetPendingEntry())
39 return true;
40
41 GURL url = web_contents->GetURL();
42 if (url.SchemeIs(content::kChromeUIScheme) &&
43 url.host() == chrome::kChromeUINewTabHost) {
44 return false;
45 }
46
47 // No favicon on Instant New Tab Pages.
48 if (chrome::IsInstantNTP(web_contents))
49 return false;
50
51 return true;
52 }
53
54 } // namespace favicon
OLDNEW
« no previous file with comments | « chrome/browser/favicon/favicon_helper.h ('k') | chrome/browser/favicon/favicon_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698