Chromium Code Reviews| Index: chrome/browser/ui/views/location_bar/location_icon_view.cc |
| diff --git a/chrome/browser/ui/views/location_bar/location_icon_view.cc b/chrome/browser/ui/views/location_bar/location_icon_view.cc |
| index f1b4fc8d396218d5b32f8973a8dcc5f903ba2775..1112783efd28cee526cc8b0fc06b44a77cdad0fb 100644 |
| --- a/chrome/browser/ui/views/location_bar/location_icon_view.cc |
| +++ b/chrome/browser/ui/views/location_bar/location_icon_view.cc |
| @@ -12,6 +12,7 @@ |
| #include "chrome/grit/generated_resources.h" |
| #include "content/public/browser/navigation_controller.h" |
| #include "content/public/browser/navigation_entry.h" |
| +#include "content/public/browser/render_frame_host.h" |
| #include "content/public/browser/web_contents.h" |
| #include "grit/components_scaled_resources.h" |
| #include "grit/theme_resources.h" |
| @@ -20,6 +21,7 @@ |
| #include "ui/gfx/color_palette.h" |
| #include "ui/views/controls/label.h" |
| #include "ui/views/painter.h" |
| +#include "url/origin.h" |
| using content::NavigationController; |
| using content::NavigationEntry; |
| @@ -34,15 +36,32 @@ void ProcessEventInternal(LocationBarView* view) { |
| // Important to use GetVisibleEntry to match what's showing in the omnibox. |
| NavigationEntry* entry = contents->GetController().GetVisibleEntry(); |
| - // The visible entry can be nullptr in the case of window.open(""). |
| - if (!entry) |
| - return; |
| + GURL url; |
| + if (entry) { |
| + if (entry->GetURL().SchemeIs(url::kAboutScheme)) { |
|
Charlie Reis
2016/04/18 19:58:38
I'd recommend comparing against kAboutBlankURL (if
palmer
2016/04/18 23:37:35
Acknowledged.
|
| + const WebContents* opener = contents->GetOpener(); |
|
Charlie Reis
2016/04/18 19:58:38
I tried to point out in the doc that opener is not
palmer
2016/04/18 23:37:35
I'm sorry; I misunderstood you as saying there mig
Charlie Reis
2016/04/19 22:32:52
This is probably due to the bug I mentioned in you
|
| + if (opener) { |
| + entry = opener->GetController().GetVisibleEntry(); |
| + } else { |
| + // TODO(palmer): Should we show the "this is a secure Chromium page" |
| + // OIB? |
| + } |
| + url = GURL(entry->GetOrigin().Serialize()); |
| + } else { |
| + url = GURL(entry->GetOrigin().Serialize()); |
|
Charlie Reis
2016/04/18 19:58:38
Why do this line on both sides of the branch?
I c
palmer
2016/04/18 23:37:35
Acknowledged.
|
| + } |
| + } else { |
| + // The visible entry can be nullptr in the case of window.open(""). |
| + url = GURL(contents->GetMainFrame()->GetLastCommittedOrigin().Serialize()); |
|
Charlie Reis
2016/04/18 19:58:38
Alex, is there a good way to do this, or should th
alexmos
2016/04/19 00:04:37
Yeah, unfortunately this is the best you can do ri
|
| + } |
| ChromeSecurityStateModelClient* model_client = |
| ChromeSecurityStateModelClient::FromWebContents(contents); |
| DCHECK(model_client); |
| - view->delegate()->ShowWebsiteSettings(contents, entry->GetURL(), |
| + // TODO(palmer): Change ShowWebsiteSettings to take an Origin, rather than a |
| + // GURL. |
| + view->delegate()->ShowWebsiteSettings(contents, url, |
| model_client->GetSecurityInfo()); |
| } |