| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/location_bar_view.h" | 5 #include "chrome/browser/views/location_bar_view.h" |
| 6 | 6 |
| 7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 | 12 |
| 13 #include "app/gfx/canvas.h" | 13 #include "app/gfx/canvas.h" |
| 14 #include "app/gfx/color_utils.h" |
| 14 #include "app/gfx/favicon_size.h" | 15 #include "app/gfx/favicon_size.h" |
| 15 #include "app/l10n_util.h" | 16 #include "app/l10n_util.h" |
| 16 #include "app/resource_bundle.h" | 17 #include "app/resource_bundle.h" |
| 17 #include "base/file_util.h" | 18 #include "base/file_util.h" |
| 18 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 19 #include "base/string_util.h" | 20 #include "base/string_util.h" |
| 20 #include "chrome/app/chrome_dll_resource.h" | 21 #include "chrome/app/chrome_dll_resource.h" |
| 21 #include "chrome/browser/alternate_nav_url_fetcher.h" | 22 #include "chrome/browser/alternate_nav_url_fetcher.h" |
| 22 #include "chrome/browser/browser.h" | 23 #include "chrome/browser/browser.h" |
| 23 #include "chrome/browser/browser_list.h" | 24 #include "chrome/browser/browser_list.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 39 #include "grit/theme_resources.h" | 40 #include "grit/theme_resources.h" |
| 40 #include "skia/ext/image_operations.h" | 41 #include "skia/ext/image_operations.h" |
| 41 #include "views/focus/focus_manager.h" | 42 #include "views/focus/focus_manager.h" |
| 42 #include "views/widget/root_view.h" | 43 #include "views/widget/root_view.h" |
| 43 #include "views/widget/widget.h" | 44 #include "views/widget/widget.h" |
| 44 #include "webkit/glue/image_decoder.h" | 45 #include "webkit/glue/image_decoder.h" |
| 45 | 46 |
| 46 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
| 47 #include "app/win_util.h" | 48 #include "app/win_util.h" |
| 48 #include "chrome/browser/views/first_run_bubble.h" | 49 #include "chrome/browser/views/first_run_bubble.h" |
| 49 #else | |
| 50 #include "base/gfx/gtk_util.h" | |
| 51 #include "chrome/browser/gtk/location_bar_view_gtk.h" | |
| 52 #endif | 50 #endif |
| 53 | 51 |
| 54 using views::View; | 52 using views::View; |
| 55 | 53 |
| 54 // static |
| 56 const int LocationBarView::kVertMargin = 2; | 55 const int LocationBarView::kVertMargin = 2; |
| 57 | 56 |
| 58 const SkColor LocationBarView::kBackgroundColorByLevel[] = { | |
| 59 SkColorSetRGB(255, 245, 195), // SecurityLevel SECURE: Yellow. | |
| 60 SkColorSetRGB(255, 255, 255), // SecurityLevel NORMAL: White. | |
| 61 SkColorSetRGB(255, 255, 255), // SecurityLevel INSECURE: White. | |
| 62 }; | |
| 63 #if defined(OS_LINUX) | |
| 64 // static | |
| 65 const GdkColor LocationBarViewGtk::kBackgroundColorByLevel[3] = { | |
| 66 GDK_COLOR_RGB(255, 245, 195), // SecurityLevel SECURE: Yellow. | |
| 67 GDK_COLOR_RGB(255, 255, 255), // SecurityLevel NORMAL: White. | |
| 68 GDK_COLOR_RGB(255, 255, 255), // SecurityLevel INSECURE: White. | |
| 69 }; | |
| 70 #endif | |
| 71 | |
| 72 // Padding on the right and left of the entry field. | 57 // Padding on the right and left of the entry field. |
| 73 static const int kEntryPadding = 3; | 58 static const int kEntryPadding = 3; |
| 74 | 59 |
| 75 // Padding between the entry and the leading/trailing views. | 60 // Padding between the entry and the leading/trailing views. |
| 76 static const int kInnerPadding = 3; | 61 static const int kInnerPadding = 3; |
| 77 | 62 |
| 78 static const SkBitmap* kBackground = NULL; | 63 static const SkBitmap* kBackground = NULL; |
| 79 | 64 |
| 80 static const SkBitmap* kPopupBackground = NULL; | 65 static const SkBitmap* kPopupBackground = NULL; |
| 81 | 66 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 LocationBarView::~LocationBarView() { | 117 LocationBarView::~LocationBarView() { |
| 133 #if defined(OS_LINUX) | 118 #if defined(OS_LINUX) |
| 134 // We must release the ref that the NativeViewHost has on the | 119 // We must release the ref that the NativeViewHost has on the |
| 135 // AutocompleteEditViewGtk, otherwise its internal OwnedWidgetGtk will | 120 // AutocompleteEditViewGtk, otherwise its internal OwnedWidgetGtk will |
| 136 // complain about its refcount not being 1 as it is destroyed. | 121 // complain about its refcount not being 1 as it is destroyed. |
| 137 location_entry_view_->Detach(); | 122 location_entry_view_->Detach(); |
| 138 #endif | 123 #endif |
| 139 DeletePageActionViews(); | 124 DeletePageActionViews(); |
| 140 } | 125 } |
| 141 | 126 |
| 142 bool LocationBarView::IsInitialized() const { | |
| 143 return location_entry_view_ != NULL; | |
| 144 } | |
| 145 | |
| 146 void LocationBarView::Init() { | 127 void LocationBarView::Init() { |
| 147 if (popup_window_mode_) { | 128 if (popup_window_mode_) { |
| 148 font_ = ResourceBundle::GetSharedInstance().GetFont( | 129 font_ = ResourceBundle::GetSharedInstance().GetFont( |
| 149 ResourceBundle::BaseFont); | 130 ResourceBundle::BaseFont); |
| 150 } else { | 131 } else { |
| 151 // Use a larger version of the system font. | 132 // Use a larger version of the system font. |
| 152 font_ = font_.DeriveFont(3); | 133 font_ = font_.DeriveFont(3); |
| 153 } | 134 } |
| 154 | 135 |
| 155 // URL edit field. | 136 // URL edit field. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 184 #else | 165 #else |
| 185 location_entry_->widget() | 166 location_entry_->widget() |
| 186 #endif | 167 #endif |
| 187 ); | 168 ); |
| 188 | 169 |
| 189 AddChildView(&selected_keyword_view_); | 170 AddChildView(&selected_keyword_view_); |
| 190 selected_keyword_view_.SetFont(font_); | 171 selected_keyword_view_.SetFont(font_); |
| 191 selected_keyword_view_.SetVisible(false); | 172 selected_keyword_view_.SetVisible(false); |
| 192 selected_keyword_view_.SetParentOwned(false); | 173 selected_keyword_view_.SetParentOwned(false); |
| 193 | 174 |
| 194 #if defined(OS_WIN) | 175 SkColor dimmed_text = GetColor(false, DEEMPHASIZED_TEXT); |
| 195 DWORD sys_color = GetSysColor(COLOR_GRAYTEXT); | |
| 196 SkColor gray = SkColorSetRGB(GetRValue(sys_color), GetGValue(sys_color), | |
| 197 GetBValue(sys_color)); | |
| 198 #else | |
| 199 NOTIMPLEMENTED(); | |
| 200 SkColor gray = SK_ColorGRAY; | |
| 201 #endif | |
| 202 | 176 |
| 203 AddChildView(&type_to_search_view_); | 177 AddChildView(&type_to_search_view_); |
| 204 type_to_search_view_.SetVisible(false); | 178 type_to_search_view_.SetVisible(false); |
| 205 type_to_search_view_.SetFont(font_); | 179 type_to_search_view_.SetFont(font_); |
| 206 type_to_search_view_.SetColor(gray); | 180 type_to_search_view_.SetColor(dimmed_text); |
| 207 type_to_search_view_.SetParentOwned(false); | 181 type_to_search_view_.SetParentOwned(false); |
| 208 | 182 |
| 209 AddChildView(&keyword_hint_view_); | 183 AddChildView(&keyword_hint_view_); |
| 210 keyword_hint_view_.SetVisible(false); | 184 keyword_hint_view_.SetVisible(false); |
| 211 keyword_hint_view_.SetFont(font_); | 185 keyword_hint_view_.SetFont(font_); |
| 212 keyword_hint_view_.SetColor(gray); | 186 keyword_hint_view_.SetColor(dimmed_text); |
| 213 keyword_hint_view_.SetParentOwned(false); | 187 keyword_hint_view_.SetParentOwned(false); |
| 214 | 188 |
| 215 AddChildView(&security_image_view_); | 189 AddChildView(&security_image_view_); |
| 216 security_image_view_.SetVisible(false); | 190 security_image_view_.SetVisible(false); |
| 217 security_image_view_.SetParentOwned(false); | 191 security_image_view_.SetParentOwned(false); |
| 218 | 192 |
| 219 AddChildView(&info_label_); | 193 AddChildView(&info_label_); |
| 220 info_label_.SetVisible(false); | 194 info_label_.SetVisible(false); |
| 221 info_label_.SetParentOwned(false); | 195 info_label_.SetParentOwned(false); |
| 222 | 196 |
| 223 // Notify us when any ancestor is resized. In this case we want to tell the | 197 // Notify us when any ancestor is resized. In this case we want to tell the |
| 224 // AutocompleteEditView to close its popup. | 198 // AutocompleteEditView to close its popup. |
| 225 SetNotifyWhenVisibleBoundsInRootChanges(true); | 199 SetNotifyWhenVisibleBoundsInRootChanges(true); |
| 226 | 200 |
| 227 // Initialize the location entry. We do this to avoid a black flash which is | 201 // Initialize the location entry. We do this to avoid a black flash which is |
| 228 // visible when the location entry has just been initialized. | 202 // visible when the location entry has just been initialized. |
| 229 Update(NULL); | 203 Update(NULL); |
| 230 | 204 |
| 231 OnChanged(); | 205 OnChanged(); |
| 232 } | 206 } |
| 233 | 207 |
| 208 bool LocationBarView::IsInitialized() const { |
| 209 return location_entry_view_ != NULL; |
| 210 } |
| 211 |
| 212 // static |
| 213 SkColor LocationBarView::GetColor(bool is_secure, ColorKind kind) { |
| 214 enum SecurityState { |
| 215 NOT_SECURE = 0, |
| 216 SECURE, |
| 217 NUM_STATES |
| 218 }; |
| 219 |
| 220 static bool initialized = false; |
| 221 static SkColor colors[NUM_STATES][NUM_KINDS]; |
| 222 if (!initialized) { |
| 223 #if defined(OS_WIN) |
| 224 colors[NOT_SECURE][BACKGROUND] = color_utils::GetSysSkColor(COLOR_WINDOW); |
| 225 colors[NOT_SECURE][TEXT] = color_utils::GetSysSkColor(COLOR_WINDOWTEXT); |
| 226 colors[NOT_SECURE][SELECTED_TEXT] = |
| 227 color_utils::GetSysSkColor(COLOR_HIGHLIGHTTEXT); |
| 228 #else |
| 229 // TODO(beng): source from theme provider. |
| 230 colors[NOT_SECURE][BACKGROUND] = SK_ColorWHITE; |
| 231 colors[NOT_SECURE][TEXT] = SK_ColorBLACK; |
| 232 colors[NOT_SECURE][SELECTED_TEXT] = SK_ColorWHITE; |
| 233 #endif |
| 234 colors[SECURE][BACKGROUND] = SkColorSetRGB(255, 245, 195); |
| 235 colors[SECURE][TEXT] = SkColorSetRGB(0, 0, 0); |
| 236 colors[SECURE][SELECTED_TEXT] = 0; // Unused |
| 237 colors[NOT_SECURE][DEEMPHASIZED_TEXT] = |
| 238 color_utils::AlphaBlend(colors[NOT_SECURE][TEXT], |
| 239 colors[NOT_SECURE][BACKGROUND], 128); |
| 240 colors[SECURE][DEEMPHASIZED_TEXT] = |
| 241 color_utils::AlphaBlend(colors[SECURE][TEXT], |
| 242 colors[SECURE][BACKGROUND], 128); |
| 243 const SkColor kDarkNotSecureText = SkColorSetRGB(200, 0, 0); |
| 244 const SkColor kLightNotSecureText = SkColorSetRGB(255, 55, 55); |
| 245 colors[NOT_SECURE][SECURITY_TEXT] = |
| 246 color_utils::PickMoreReadableColor(kDarkNotSecureText, |
| 247 kLightNotSecureText, |
| 248 colors[NOT_SECURE][BACKGROUND]); |
| 249 colors[SECURE][SECURITY_TEXT] = SkColorSetRGB(0, 150, 20); |
| 250 #if 0 // Info bubble background color is system theme window background color |
| 251 colors[NOT_SECURE][SECURITY_INFO_BUBBLE_TEXT] = |
| 252 colors[NOT_SECURE][SECURITY_TEXT]; |
| 253 const SkColor kDarkSecureInfoBubbleText = SkColorSetRGB(0, 153, 51); |
| 254 const SkColor kLightSecureInfoBubbleText = SkColorSetRGB(102, 255, 152); |
| 255 colors[SECURE][SECURITY_INFO_BUBBLE_TEXT] = |
| 256 color_utils::PickMoreReadableColor(kDarkSecureInfoBubbleText, |
| 257 kLightSecureInfoBubbleText, |
| 258 colors[NOT_SECURE][BACKGROUND]); |
| 259 #else // Info bubble background color is white |
| 260 colors[NOT_SECURE][SECURITY_INFO_BUBBLE_TEXT] = kDarkNotSecureText; |
| 261 colors[SECURE][SECURITY_INFO_BUBBLE_TEXT] = SkColorSetRGB(0, 153, 51); |
| 262 #endif |
| 263 const SkColor kDarkSchemeStrikeout = SkColorSetRGB(210, 0, 0); |
| 264 const SkColor kLightSchemeStrikeout = SkColorSetRGB(255, 45, 45); |
| 265 colors[NOT_SECURE][SCHEME_STRIKEOUT] = |
| 266 color_utils::PickMoreReadableColor(kDarkSchemeStrikeout, |
| 267 kLightSchemeStrikeout, |
| 268 colors[NOT_SECURE][BACKGROUND]); |
| 269 colors[SECURE][SCHEME_STRIKEOUT] = 0; // Unused |
| 270 initialized = true; |
| 271 } |
| 272 |
| 273 return colors[is_secure ? SECURE : NOT_SECURE][kind]; |
| 274 } |
| 275 |
| 234 void LocationBarView::Update(const TabContents* tab_for_state_restoring) { | 276 void LocationBarView::Update(const TabContents* tab_for_state_restoring) { |
| 235 SetSecurityIcon(model_->GetIcon()); | 277 SetSecurityIcon(model_->GetIcon()); |
| 236 RefreshPageActionViews(); | 278 RefreshPageActionViews(); |
| 237 std::wstring info_text, info_tooltip; | 279 std::wstring info_text, info_tooltip; |
| 238 ToolbarModel::InfoTextType info_text_type = | 280 ToolbarModel::InfoTextType info_text_type = |
| 239 model_->GetInfoText(&info_text, &info_tooltip); | 281 model_->GetInfoText(&info_text, &info_tooltip); |
| 240 SetInfoText(info_text, info_text_type, info_tooltip); | 282 SetInfoText(info_text, info_text_type, info_tooltip); |
| 241 location_entry_->Update(tab_for_state_restoring); | 283 location_entry_->Update(tab_for_state_restoring); |
| 242 Layout(); | 284 Layout(); |
| 243 SchedulePaint(); | 285 SchedulePaint(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 274 (popup_window_mode_ ? kPopupBackground : kBackground)->height()); | 316 (popup_window_mode_ ? kPopupBackground : kBackground)->height()); |
| 275 } | 317 } |
| 276 | 318 |
| 277 void LocationBarView::Layout() { | 319 void LocationBarView::Layout() { |
| 278 DoLayout(true); | 320 DoLayout(true); |
| 279 } | 321 } |
| 280 | 322 |
| 281 void LocationBarView::Paint(gfx::Canvas* canvas) { | 323 void LocationBarView::Paint(gfx::Canvas* canvas) { |
| 282 View::Paint(canvas); | 324 View::Paint(canvas); |
| 283 | 325 |
| 284 SkColor bg = kBackgroundColorByLevel[model_->GetSchemeSecurityLevel()]; | |
| 285 | |
| 286 const SkBitmap* background = | 326 const SkBitmap* background = |
| 287 popup_window_mode_ ? | 327 popup_window_mode_ ? |
| 288 kPopupBackground : | 328 kPopupBackground : |
| 289 GetThemeProvider()->GetBitmapNamed(IDR_LOCATIONBG); | 329 GetThemeProvider()->GetBitmapNamed(IDR_LOCATIONBG); |
| 290 | 330 |
| 291 canvas->TileImageInt(*background, 0, 0, 0, 0, width(), height()); | 331 canvas->TileImageInt(*background, 0, 0, 0, 0, width(), height()); |
| 292 int top_margin = TopMargin(); | 332 int top_margin = TopMargin(); |
| 293 canvas->FillRectInt(bg, 0, top_margin, width(), | 333 canvas->FillRectInt( |
| 294 std::max(height() - top_margin - kVertMargin, 0)); | 334 GetColor(model_->GetSchemeSecurityLevel() == ToolbarModel::SECURE, |
| 335 BACKGROUND), |
| 336 0, top_margin, width(), std::max(height() - top_margin - kVertMargin, 0)); |
| 295 } | 337 } |
| 296 | 338 |
| 297 void LocationBarView::VisibleBoundsInRootChanged() { | 339 void LocationBarView::VisibleBoundsInRootChanged() { |
| 298 location_entry_->ClosePopup(); | 340 location_entry_->ClosePopup(); |
| 299 } | 341 } |
| 300 | 342 |
| 301 #if defined(OS_WIN) | 343 #if defined(OS_WIN) |
| 302 bool LocationBarView::OnMousePressed(const views::MouseEvent& event) { | 344 bool LocationBarView::OnMousePressed(const views::MouseEvent& event) { |
| 303 UINT msg; | 345 UINT msg; |
| 304 if (event.IsLeftMouseButton()) { | 346 if (event.IsLeftMouseButton()) { |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 page_action_image_views_[i]->UpdateVisibility(contents, url); | 700 page_action_image_views_[i]->UpdateVisibility(contents, url); |
| 659 } | 701 } |
| 660 } | 702 } |
| 661 | 703 |
| 662 void LocationBarView::SetInfoText(const std::wstring& text, | 704 void LocationBarView::SetInfoText(const std::wstring& text, |
| 663 ToolbarModel::InfoTextType text_type, | 705 ToolbarModel::InfoTextType text_type, |
| 664 const std::wstring& tooltip_text) { | 706 const std::wstring& tooltip_text) { |
| 665 info_label_.SetVisible(!text.empty()); | 707 info_label_.SetVisible(!text.empty()); |
| 666 info_label_.SetText(text); | 708 info_label_.SetText(text); |
| 667 if (text_type == ToolbarModel::INFO_EV_TEXT) | 709 if (text_type == ToolbarModel::INFO_EV_TEXT) |
| 668 info_label_.SetColor(SkColorSetRGB(0, 150, 20)); // Green. | 710 info_label_.SetColor(GetColor(true, SECURITY_TEXT)); |
| 669 info_label_.SetTooltipText(tooltip_text); | 711 info_label_.SetTooltipText(tooltip_text); |
| 670 } | 712 } |
| 671 | 713 |
| 672 bool LocationBarView::ToggleVisibility(bool new_vis, View* view) { | 714 bool LocationBarView::ToggleVisibility(bool new_vis, View* view) { |
| 673 DCHECK(view); | 715 DCHECK(view); |
| 674 if (view->IsVisible() != new_vis) { | 716 if (view->IsVisible() != new_vis) { |
| 675 view->SetVisible(new_vis); | 717 view->SetVisible(new_vis); |
| 676 return true; | 718 return true; |
| 677 } | 719 } |
| 678 return false; | 720 return false; |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 if (!nav_entry) { | 1181 if (!nav_entry) { |
| 1140 NOTREACHED(); | 1182 NOTREACHED(); |
| 1141 return true; | 1183 return true; |
| 1142 } | 1184 } |
| 1143 tab->ShowPageInfo(nav_entry->url(), nav_entry->ssl(), true); | 1185 tab->ShowPageInfo(nav_entry->url(), nav_entry->ssl(), true); |
| 1144 return true; | 1186 return true; |
| 1145 } | 1187 } |
| 1146 | 1188 |
| 1147 void LocationBarView::SecurityImageView::ShowInfoBubble() { | 1189 void LocationBarView::SecurityImageView::ShowInfoBubble() { |
| 1148 std::wstring text; | 1190 std::wstring text; |
| 1149 SkColor text_color; | 1191 model_->GetIconHoverText(&text); |
| 1150 model_->GetIconHoverText(&text, &text_color); | 1192 ShowInfoBubbleImpl(text, GetColor( |
| 1151 | 1193 model_->GetSecurityLevel() == ToolbarModel::SECURE, |
| 1152 ShowInfoBubbleImpl(text, text_color); | 1194 SECURITY_INFO_BUBBLE_TEXT)); |
| 1153 } | 1195 } |
| 1154 | 1196 |
| 1155 // PageActionImageView---------------------------------------------------------- | 1197 // PageActionImageView---------------------------------------------------------- |
| 1156 | 1198 |
| 1157 // The views need to load their icons asynchronously but might be deleted before | 1199 // The views need to load their icons asynchronously but might be deleted before |
| 1158 // the images have loaded. This class stays alive while the request is in | 1200 // the images have loaded. This class stays alive while the request is in |
| 1159 // progress (manages its own lifetime) and keeps track of whether the view still | 1201 // progress (manages its own lifetime) and keeps track of whether the view still |
| 1160 // cares about the icon loading. | 1202 // cares about the icon loading. |
| 1161 class LocationBarView::PageActionImageView::ImageLoadingTracker | 1203 class LocationBarView::PageActionImageView::ImageLoadingTracker |
| 1162 : public base::RefCountedThreadSafe<ImageLoadingTracker> { | 1204 : public base::RefCountedThreadSafe<ImageLoadingTracker> { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 bool LocationBarView::PageActionImageView::OnMousePressed( | 1347 bool LocationBarView::PageActionImageView::OnMousePressed( |
| 1306 const views::MouseEvent& event) { | 1348 const views::MouseEvent& event) { |
| 1307 // Our PageAction icon was clicked on, notify proper authorities. | 1349 // Our PageAction icon was clicked on, notify proper authorities. |
| 1308 ExtensionBrowserEventRouter::GetInstance()->PageActionExecuted( | 1350 ExtensionBrowserEventRouter::GetInstance()->PageActionExecuted( |
| 1309 profile_, page_action_->extension_id(), page_action_->id(), | 1351 profile_, page_action_->extension_id(), page_action_->id(), |
| 1310 current_tab_id_, current_url_.spec()); | 1352 current_tab_id_, current_url_.spec()); |
| 1311 return true; | 1353 return true; |
| 1312 } | 1354 } |
| 1313 | 1355 |
| 1314 void LocationBarView::PageActionImageView::ShowInfoBubble() { | 1356 void LocationBarView::PageActionImageView::ShowInfoBubble() { |
| 1315 SkColor text_color = SK_ColorBLACK; | 1357 #if 0 // Info bubble background color is system theme window background color |
| 1316 ShowInfoBubbleImpl(ASCIIToWide(tooltip_), text_color); | 1358 ShowInfoBubbleImpl(ASCIIToWide(tooltip_), GetColor(false, TEXT)); |
| 1359 #else // Info bubble background color is white |
| 1360 ShowInfoBubbleImpl(ASCIIToWide(tooltip_), SK_ColorBLACK); |
| 1361 #endif |
| 1317 } | 1362 } |
| 1318 | 1363 |
| 1319 void LocationBarView::PageActionImageView::UpdateVisibility( | 1364 void LocationBarView::PageActionImageView::UpdateVisibility( |
| 1320 TabContents* contents, GURL url) { | 1365 TabContents* contents, GURL url) { |
| 1321 // Save this off so we can pass it back to the extension when the action gets | 1366 // Save this off so we can pass it back to the extension when the action gets |
| 1322 // executed. See PageActionImageView::OnMousePressed. | 1367 // executed. See PageActionImageView::OnMousePressed. |
| 1323 current_tab_id_ = ExtensionTabUtil::GetTabId(contents); | 1368 current_tab_id_ = ExtensionTabUtil::GetTabId(contents); |
| 1324 current_url_ = url; | 1369 current_url_ = url; |
| 1325 | 1370 |
| 1326 const PageActionState* state = contents->GetPageActionState(page_action_); | 1371 const PageActionState* state = contents->GetPageActionState(page_action_); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1399 } | 1444 } |
| 1400 | 1445 |
| 1401 int LocationBarView::PageActionVisibleCount() { | 1446 int LocationBarView::PageActionVisibleCount() { |
| 1402 int result = 0; | 1447 int result = 0; |
| 1403 for (size_t i = 0; i < page_action_image_views_.size(); i++) { | 1448 for (size_t i = 0; i < page_action_image_views_.size(); i++) { |
| 1404 if (page_action_image_views_[i]->IsVisible()) | 1449 if (page_action_image_views_[i]->IsVisible()) |
| 1405 ++result; | 1450 ++result; |
| 1406 } | 1451 } |
| 1407 return result; | 1452 return result; |
| 1408 } | 1453 } |
| OLD | NEW |