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

Side by Side Diff: chrome/browser/ui/extensions/hosted_app_browser_controller.cc

Issue 2363623002: Remove SecurityStateModel memoization (Closed)
Patch Set: Created 4 years, 3 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
OLDNEW
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/hosted_app_browser_controller.h" 5 #include "chrome/browser/ui/extensions/hosted_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/chrome_security_state_model_client.h" 9 #include "chrome/browser/ssl/chrome_security_state_model_client.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 if (!extension->is_hosted_app()) 91 if (!extension->is_hosted_app())
92 return false; 92 return false;
93 93
94 // Don't show a location bar until a navigation has occurred. 94 // Don't show a location bar until a navigation has occurred.
95 if (web_contents->GetLastCommittedURL().is_empty()) 95 if (web_contents->GetLastCommittedURL().is_empty())
96 return false; 96 return false;
97 97
98 const ChromeSecurityStateModelClient* model_client = 98 const ChromeSecurityStateModelClient* model_client =
99 ChromeSecurityStateModelClient::FromWebContents(web_contents); 99 ChromeSecurityStateModelClient::FromWebContents(web_contents);
100 security_state::SecurityStateModel::SecurityInfo security_info;
101 model_client->GetSecurityInfo(&security_info);
100 if (model_client && 102 if (model_client &&
101 model_client->GetSecurityInfo().security_level == 103 security_info.security_level ==
102 security_state::SecurityStateModel::SECURITY_ERROR) 104 security_state::SecurityStateModel::SECURITY_ERROR)
103 return true; 105 return true;
104 106
105 GURL launch_url = AppLaunchInfo::GetLaunchWebURL(extension); 107 GURL launch_url = AppLaunchInfo::GetLaunchWebURL(extension);
106 return !(IsSameOriginOrMoreSecure(launch_url, 108 return !(IsSameOriginOrMoreSecure(launch_url,
107 web_contents->GetVisibleURL()) && 109 web_contents->GetVisibleURL()) &&
108 IsSameOriginOrMoreSecure(launch_url, 110 IsSameOriginOrMoreSecure(launch_url,
109 web_contents->GetLastCommittedURL())); 111 web_contents->GetLastCommittedURL()));
110 } 112 }
111 113
112 void HostedAppBrowserController::UpdateLocationBarVisibility( 114 void HostedAppBrowserController::UpdateLocationBarVisibility(
113 bool animate) const { 115 bool animate) const {
114 if (!SupportsLocationBar()) 116 if (!SupportsLocationBar())
115 return; 117 return;
116 118
117 browser_->window()->GetLocationBar()->UpdateLocationBarVisibility( 119 browser_->window()->GetLocationBar()->UpdateLocationBarVisibility(
118 ShouldShowLocationBar(), animate); 120 ShouldShowLocationBar(), animate);
119 } 121 }
120 122
121 } // namespace extensions 123 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698