OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/banners/app_banner_manager.h" | 5 #include "chrome/browser/banners/app_banner_manager.h" |
6 | 6 |
7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
8 #include "chrome/browser/banners/app_banner_data_fetcher.h" | 8 #include "chrome/browser/banners/app_banner_data_fetcher.h" |
| 9 #include "chrome/browser/banners/app_banner_debug_log.h" |
9 #include "chrome/browser/banners/app_banner_settings_helper.h" | 10 #include "chrome/browser/banners/app_banner_settings_helper.h" |
10 #include "content/public/browser/navigation_details.h" | 11 #include "content/public/browser/navigation_details.h" |
11 #include "content/public/browser/render_frame_host.h" | 12 #include "content/public/browser/render_frame_host.h" |
12 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
13 #include "content/public/common/frame_navigate_params.h" | 14 #include "content/public/common/frame_navigate_params.h" |
14 #include "content/public/common/origin_util.h" | 15 #include "content/public/common/origin_util.h" |
15 #include "net/base/load_flags.h" | 16 #include "net/base/load_flags.h" |
16 #include "ui/gfx/screen.h" | 17 #include "ui/gfx/screen.h" |
17 | 18 |
18 namespace { | 19 namespace { |
(...skipping 24 matching lines...) Expand all Loading... |
43 if (render_frame_host->GetParent()) | 44 if (render_frame_host->GetParent()) |
44 return; | 45 return; |
45 | 46 |
46 if (data_fetcher_.get() && data_fetcher_->is_active() && | 47 if (data_fetcher_.get() && data_fetcher_->is_active() && |
47 URLsAreForTheSamePage(data_fetcher_->validated_url(), validated_url)) { | 48 URLsAreForTheSamePage(data_fetcher_->validated_url(), validated_url)) { |
48 return; | 49 return; |
49 } | 50 } |
50 | 51 |
51 // A secure origin is required to show banners, so exit early if we see the | 52 // A secure origin is required to show banners, so exit early if we see the |
52 // URL is invalid. | 53 // URL is invalid. |
53 if (!content::IsOriginSecure(validated_url) && !gDisableSecureCheckForTesting) | 54 if (!content::IsOriginSecure(validated_url) && |
| 55 !gDisableSecureCheckForTesting) { |
| 56 OutputDeveloperNotShownMessage(web_contents(), kNotServedFromSecureOrigin); |
54 return; | 57 return; |
| 58 } |
55 | 59 |
56 // Kick off the data retrieval pipeline. | 60 // Kick off the data retrieval pipeline. |
57 data_fetcher_ = CreateAppBannerDataFetcher(weak_factory_.GetWeakPtr(), | 61 data_fetcher_ = CreateAppBannerDataFetcher(weak_factory_.GetWeakPtr(), |
58 ideal_icon_size_); | 62 ideal_icon_size_); |
59 data_fetcher_->Start(validated_url); | 63 data_fetcher_->Start(validated_url); |
60 } | 64 } |
61 | 65 |
62 | 66 |
63 bool AppBannerManager::HandleNonWebApp(const std::string& platform, | 67 bool AppBannerManager::HandleNonWebApp(const std::string& platform, |
64 const GURL& url, | 68 const GURL& url, |
(...skipping 27 matching lines...) Expand all Loading... |
92 | 96 |
93 void AppBannerManager::DisableSecureSchemeCheckForTesting() { | 97 void AppBannerManager::DisableSecureSchemeCheckForTesting() { |
94 gDisableSecureCheckForTesting = true; | 98 gDisableSecureCheckForTesting = true; |
95 } | 99 } |
96 | 100 |
97 bool AppBannerManager::IsEnabled() { | 101 bool AppBannerManager::IsEnabled() { |
98 return base::FieldTrialList::FindFullName("AppBanners") == "Enabled"; | 102 return base::FieldTrialList::FindFullName("AppBanners") == "Enabled"; |
99 } | 103 } |
100 | 104 |
101 } // namespace banners | 105 } // namespace banners |
OLD | NEW |