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

Unified Diff: chrome/browser/ui/views/location_bar/location_icon_view.cc

Issue 1814993002: Handle about:blank in the Origin Info Bubble better. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No GetOpener at all. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
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..1c67ca36514e89c02b154bf2c843dd9fb52a2af9 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,26 @@ 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;
+
+ // Show the origin if it's not unique, and otherwise fall back to the URL.
+ //
+ // TODO(palmer): Should we show the "this is a secure Chromium page"
+ // OIB when origin is unique and there is no last committed origin?
+ url::Origin origin = entry
+ ? entry->GetOrigin()
+ : contents->GetMainFrame()->GetLastCommittedOrigin();
+ GURL url(origin.Serialize());
+ if (entry && origin.unique()) {
+ url = GURL(contents->GetMainFrame()->GetLastCommittedOrigin().Serialize());
+ }
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());
}

Powered by Google App Engine
This is Rietveld 408576698