diff options
author | brettw <brettw@chromium.org> | 2015-07-10 17:20:51 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-11 00:21:39 +0000 |
commit | 39355da5ab86e662d701fcba8fef4e20921b38f0 (patch) | |
tree | 237011a4b86a64c44ebecb802bcccda7a931ccd5 /chrome/browser/favicon/favicon_utils.cc | |
parent | 117ee8b5ff7a2d37aaf2f2f05ca9338260ec8bb6 (diff) | |
download | chromium_src-39355da5ab86e662d701fcba8fef4e20921b38f0.zip chromium_src-39355da5ab86e662d701fcba8fef4e20921b38f0.tar.gz chromium_src-39355da5ab86e662d701fcba8fef4e20921b38f0.tar.bz2 |
Move GN obj files to target-specific dirs
Previously GN would put object files in a similar place to GYP. They would go in a corresponding directory as the source file and would be prefixed with the target name for uniqueness.
Since GN target names are not unique, this doesn't work as well. Instead use a simpler scheme and put all the object files in a directory for each target.
This causes a few object file name collisions which this patch fixes in various ways:
- Renamed chrome/browser/ui/views/find_bar_host_interactive_uitest.cc to have "views" in the name (collided with chrome/browser/ui/find_bar/find_bar_host_interactive_uitest.cc)
- Renamed chrome/browser/apps/speech_recognition_browsertest.cc to have "app" in the name (collided with chrome/browser/speech/speech_recognition_browsertest.cc).
- Renamed chrome/common/extensions/api/extension_api_unittest.cc to have "common" in the name (collided with chrome/browser/extensions/extension_api_unittest.cc which is actually a test harness with that name).
- Moved the extensions files that were in the chrome interactive UI tests and browser tests to source sets in the extensions directory. These are things that should be cleaned up and moved there anyway.
- Net has some messy duplication in quic files. I made a dummy target for them. Apparently each copy of this file (same code, different namespace) is supposed to match something different upstream and this should be fixed.
- Moved chrome/browser/chromeos unit tests to its own target.
- Renamed chrome/browser/favicon/favicon_helper to favicon_utils. It conflicted with chrome/browser/android/favicon_helper which has an actual class named "FaviconHelper.
- Renamed service.* and service_factory.* in chrome/browser/chromeos/launcher_search_provider to have a launcher_search_provider prefix to avoid collisions with the file_system_provider one.
- Added a "chromeos" prefix to chrome/browser/chromeos/first_run/first_run_browsertest.cc to avoid collisions with the one in browser/first_run.
- Added "chromeos" to chrome/browser/chromeos/preferences_browsertest.cc to avoid collision with browser/ui/webui/options.
- Rename "chrome/browser/chromeos/drive/test_util.*" to "drive_test_util.*". Update includes. Rename chrome/browser/chromeos/file_manager/drive_test_util* to mount_test_util to avoid colliding with above new file.
The deps->public_deps changes in components/policy and content/test is because those targets were used externally in a way that this patch uncovered.
Review URL: https://codereview.chromium.org/1208963003
Cr-Commit-Position: refs/heads/master@{#338408}
Diffstat (limited to 'chrome/browser/favicon/favicon_utils.cc')
-rw-r--r-- | chrome/browser/favicon/favicon_utils.cc | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/chrome/browser/favicon/favicon_utils.cc b/chrome/browser/favicon/favicon_utils.cc new file mode 100644 index 0000000..7be1942 --- /dev/null +++ b/chrome/browser/favicon/favicon_utils.cc @@ -0,0 +1,54 @@ +// 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/favicon/favicon_utils.h" + +#include "chrome/browser/bookmarks/bookmark_model_factory.h" +#include "chrome/browser/favicon/favicon_service_factory.h" +#include "chrome/browser/history/history_service_factory.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/search/search.h" +#include "chrome/common/url_constants.h" +#include "content/public/common/favicon_url.h" + +namespace favicon { + +void CreateContentFaviconDriverForWebContents( + content::WebContents* web_contents) { + DCHECK(web_contents); + if (ContentFaviconDriver::FromWebContents(web_contents)) + return; + + Profile* original_profile = + Profile::FromBrowserContext(web_contents->GetBrowserContext()) + ->GetOriginalProfile(); + return ContentFaviconDriver::CreateForWebContents( + web_contents, FaviconServiceFactory::GetForProfile( + original_profile, ServiceAccessType::IMPLICIT_ACCESS), + HistoryServiceFactory::GetForProfile(original_profile, + ServiceAccessType::IMPLICIT_ACCESS), + BookmarkModelFactory::GetForProfileIfExists(original_profile)); +} + +bool ShouldDisplayFavicon(content::WebContents* web_contents) { + // Always display a throbber during pending loads. + const content::NavigationController& controller = + web_contents->GetController(); + if (controller.GetLastCommittedEntry() && controller.GetPendingEntry()) + return true; + + GURL url = web_contents->GetURL(); + if (url.SchemeIs(content::kChromeUIScheme) && + url.host() == chrome::kChromeUINewTabHost) { + return false; + } + + // No favicon on Instant New Tab Pages. + if (chrome::IsInstantNTP(web_contents)) + return false; + + return true; +} + +} // namespace favicon |