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/ui/extensions/bookmark_app_browser_controller.h" | 5 #include "chrome/browser/ui/extensions/bookmark_app_browser_controller.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ssl/connection_security_helper.h" |
9 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
11 #include "chrome/browser/ui/host_desktop.h" | 12 #include "chrome/browser/ui/host_desktop.h" |
12 #include "chrome/browser/ui/location_bar/location_bar.h" | 13 #include "chrome/browser/ui/location_bar/location_bar.h" |
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
14 #include "chrome/browser/web_applications/web_app.h" | 15 #include "chrome/browser/web_applications/web_app.h" |
15 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
16 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 17 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
18 #include "extensions/browser/extension_registry.h" | 19 #include "extensions/browser/extension_registry.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 if (!extension || !web_contents) | 77 if (!extension || !web_contents) |
77 return false; | 78 return false; |
78 | 79 |
79 if (!extension->from_bookmark()) | 80 if (!extension->from_bookmark()) |
80 return false; | 81 return false; |
81 | 82 |
82 // Don't show a location bar until a navigation has occurred. | 83 // Don't show a location bar until a navigation has occurred. |
83 if (web_contents->GetLastCommittedURL().is_empty()) | 84 if (web_contents->GetLastCommittedURL().is_empty()) |
84 return false; | 85 return false; |
85 | 86 |
| 87 ConnectionSecurityHelper::SecurityLevel security_level = |
| 88 ConnectionSecurityHelper::GetSecurityLevelForWebContents(web_contents); |
| 89 if (security_level == ConnectionSecurityHelper::SECURITY_ERROR) |
| 90 return true; |
| 91 |
86 GURL launch_url = AppLaunchInfo::GetLaunchWebURL(extension); | 92 GURL launch_url = AppLaunchInfo::GetLaunchWebURL(extension); |
87 return !(IsSameOriginOrMoreSecure(launch_url, | 93 return !(IsSameOriginOrMoreSecure(launch_url, |
88 web_contents->GetVisibleURL()) && | 94 web_contents->GetVisibleURL()) && |
89 IsSameOriginOrMoreSecure(launch_url, | 95 IsSameOriginOrMoreSecure(launch_url, |
90 web_contents->GetLastCommittedURL())); | 96 web_contents->GetLastCommittedURL())); |
91 } | 97 } |
92 | 98 |
93 void BookmarkAppBrowserController::UpdateLocationBarVisibility(bool animate) { | 99 void BookmarkAppBrowserController::UpdateLocationBarVisibility(bool animate) { |
94 if (!SupportsLocationBar()) | 100 if (!SupportsLocationBar()) |
95 return; | 101 return; |
96 | 102 |
97 browser_->window()->GetLocationBar()->UpdateLocationBarVisibility( | 103 browser_->window()->GetLocationBar()->UpdateLocationBarVisibility( |
98 ShouldShowLocationBar(), animate); | 104 ShouldShowLocationBar(), animate); |
99 } | 105 } |
100 | 106 |
101 } // namespace extensions | 107 } // namespace extensions |
OLD | NEW |