summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/ui/cocoa/location_bar/origin_chip_decoration.mm2
-rw-r--r--chrome/browser/ui/toolbar/origin_chip_info.cc4
-rw-r--r--chrome/browser/ui/toolbar/origin_chip_info.h3
-rw-r--r--chrome/browser/ui/toolbar/origin_chip_info_unittest.cc15
4 files changed, 20 insertions, 4 deletions
diff --git a/chrome/browser/ui/cocoa/location_bar/origin_chip_decoration.mm b/chrome/browser/ui/cocoa/location_bar/origin_chip_decoration.mm
index 225b2df..43ca9ad 100644
--- a/chrome/browser/ui/cocoa/location_bar/origin_chip_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/origin_chip_decoration.mm
@@ -186,7 +186,7 @@ void OriginChipDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
}
NSString* OriginChipDecoration::GetToolTip() {
- return label_.get();
+ return base::SysUTF16ToNSString(info_.Tooltip());
}
bool OriginChipDecoration::OnMousePressed(NSRect frame) {
diff --git a/chrome/browser/ui/toolbar/origin_chip_info.cc b/chrome/browser/ui/toolbar/origin_chip_info.cc
index 3026af8..84572f9 100644
--- a/chrome/browser/ui/toolbar/origin_chip_info.cc
+++ b/chrome/browser/ui/toolbar/origin_chip_info.cc
@@ -144,6 +144,10 @@ bool OriginChipInfo::Update(const content::WebContents* web_contents,
return true;
}
+base::string16 OriginChipInfo::Tooltip() const {
+ return base::UTF8ToUTF16(displayed_url_.spec());
+}
+
// static
bool OriginChip::IsMalware(const GURL& url, const content::WebContents* tab) {
DCHECK(tab);
diff --git a/chrome/browser/ui/toolbar/origin_chip_info.h b/chrome/browser/ui/toolbar/origin_chip_info.h
index 92179242..d50f48b 100644
--- a/chrome/browser/ui/toolbar/origin_chip_info.h
+++ b/chrome/browser/ui/toolbar/origin_chip_info.h
@@ -33,6 +33,9 @@ class OriginChipInfo {
// Returns the label to be displayed by the origin chip.
const base::string16& label() const { return label_; }
+ // Returns the tooltip to be used for the origin chip.
+ base::string16 Tooltip() const;
+
// Returns the ID of the icon to be displayed by the origin chip. Note that
// if |owner_|'s OnExtensionIconImageChanged() method was called with
// anything else than NULL, that icon has precedence over whatever this method
diff --git a/chrome/browser/ui/toolbar/origin_chip_info_unittest.cc b/chrome/browser/ui/toolbar/origin_chip_info_unittest.cc
index 100469f..82df8aa 100644
--- a/chrome/browser/ui/toolbar/origin_chip_info_unittest.cc
+++ b/chrome/browser/ui/toolbar/origin_chip_info_unittest.cc
@@ -108,6 +108,7 @@ TEST_F(OriginChipInfoTest, NormalOrigin) {
SetURL(kExampleUrl, true);
EXPECT_EQ(base::ASCIIToUTF16("example.com"), info()->label());
+ EXPECT_EQ(base::ASCIIToUTF16(kExampleUrl), info()->Tooltip());
EXPECT_EQ(url(), info()->displayed_url());
EXPECT_EQ(ToolbarModel::NONE, info()->security_level());
}
@@ -118,22 +119,27 @@ TEST_F(OriginChipInfoTest, EVSecureOrigin) {
SetURL(kExampleUrlSecure, true);
EXPECT_EQ(base::ASCIIToUTF16("Example [US] example.com"), info()->label());
+ EXPECT_EQ(base::ASCIIToUTF16(kExampleUrlSecure), info()->Tooltip());
EXPECT_EQ(url(), info()->displayed_url());
EXPECT_EQ(ToolbarModel::EV_SECURE, info()->security_level());
}
TEST_F(OriginChipInfoTest, ChromeOrigin) {
- SetURL("chrome://version", true);
+ const char kChromeOrigin1[] = "chrome://version/";
+ SetURL(kChromeOrigin1, true);
EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_TITLE),
info()->label());
+ EXPECT_EQ(base::ASCIIToUTF16(kChromeOrigin1), info()->Tooltip());
EXPECT_EQ(url(), info()->displayed_url());
EXPECT_EQ(IDR_PRODUCT_LOGO_16, info()->icon());
// chrome://flags has no title, so the title should be the product name.
- SetURL("chrome://flags", true);
+ const char kChromeOrigin2[] = "chrome://flags/";
+ SetURL(kChromeOrigin2, true);
EXPECT_EQ(l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME), info()->label());
+ EXPECT_EQ(base::ASCIIToUTF16(kChromeOrigin2), info()->Tooltip());
EXPECT_EQ(url(), info()->displayed_url());
EXPECT_EQ(IDR_PRODUCT_LOGO_16, info()->icon());
@@ -167,9 +173,12 @@ TEST_F(OriginChipInfoTest, ExtensionOrigin) {
const extensions::IconImage* null_image = NULL;
// Navigate to a URL from that extension.
- SetURL(base::StringPrintf("chrome-extension://%s/index.html", kFooId), true);
+ const std::string extension_origin =
+ base::StringPrintf("chrome-extension://%s/index.html", kFooId);
+ SetURL(extension_origin, true);
EXPECT_NE(null_image, icon_image());
EXPECT_EQ(base::ASCIIToUTF16(kFooName), info()->label());
+ EXPECT_EQ(base::ASCIIToUTF16(extension_origin), info()->Tooltip());
SetURL(kExampleUrl, true);
EXPECT_EQ(null_image, icon_image());