| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 case EV_BUBBLE_TEXT_AND_BORDER: | 323 case EV_BUBBLE_TEXT_AND_BORDER: |
| 324 return ui::MaterialDesignController::IsModeMaterial() | 324 return ui::MaterialDesignController::IsModeMaterial() |
| 325 ? gfx::kGoogleGreen700 | 325 ? gfx::kGoogleGreen700 |
| 326 : SkColorSetRGB(7, 149, 0); | 326 : SkColorSetRGB(7, 149, 0); |
| 327 } | 327 } |
| 328 NOTREACHED(); | 328 NOTREACHED(); |
| 329 return gfx::kPlaceholderColor; | 329 return gfx::kPlaceholderColor; |
| 330 } | 330 } |
| 331 | 331 |
| 332 SkColor LocationBarView::GetSecureTextColor( | 332 SkColor LocationBarView::GetSecureTextColor( |
| 333 SecurityStateModel::SecurityLevel security_level) const { | 333 security_state::SecurityStateModel::SecurityLevel security_level) const { |
| 334 bool inverted = color_utils::IsDark(GetColor(BACKGROUND)); | 334 bool inverted = color_utils::IsDark(GetColor(BACKGROUND)); |
| 335 SkColor color; | 335 SkColor color; |
| 336 switch (security_level) { | 336 switch (security_level) { |
| 337 case SecurityStateModel::EV_SECURE: | 337 case security_state::SecurityStateModel::EV_SECURE: |
| 338 case SecurityStateModel::SECURE: | 338 case security_state::SecurityStateModel::SECURE: |
| 339 if (ui::MaterialDesignController::IsModeMaterial() && inverted) | 339 if (ui::MaterialDesignController::IsModeMaterial() && inverted) |
| 340 return GetColor(TEXT); | 340 return GetColor(TEXT); |
| 341 color = GetColor(EV_BUBBLE_TEXT_AND_BORDER); | 341 color = GetColor(EV_BUBBLE_TEXT_AND_BORDER); |
| 342 break; | 342 break; |
| 343 | 343 |
| 344 case SecurityStateModel::SECURITY_POLICY_WARNING: | 344 case security_state::SecurityStateModel::SECURITY_POLICY_WARNING: |
| 345 return GetColor(DEEMPHASIZED_TEXT); | 345 return GetColor(DEEMPHASIZED_TEXT); |
| 346 break; | 346 break; |
| 347 | 347 |
| 348 case SecurityStateModel::SECURITY_ERROR: { | 348 case security_state::SecurityStateModel::SECURITY_ERROR: { |
| 349 bool md = ui::MaterialDesignController::IsModeMaterial(); | 349 bool md = ui::MaterialDesignController::IsModeMaterial(); |
| 350 if (md && inverted) | 350 if (md && inverted) |
| 351 return GetColor(TEXT); | 351 return GetColor(TEXT); |
| 352 color = md ? gfx::kGoogleRed700 : SkColorSetRGB(162, 0, 0); | 352 color = md ? gfx::kGoogleRed700 : SkColorSetRGB(162, 0, 0); |
| 353 break; | 353 break; |
| 354 } | 354 } |
| 355 | 355 |
| 356 case SecurityStateModel::SECURITY_WARNING: | 356 case security_state::SecurityStateModel::SECURITY_WARNING: |
| 357 return GetColor(TEXT); | 357 return GetColor(TEXT); |
| 358 break; | 358 break; |
| 359 | 359 |
| 360 default: | 360 default: |
| 361 NOTREACHED(); | 361 NOTREACHED(); |
| 362 return gfx::kPlaceholderColor; | 362 return gfx::kPlaceholderColor; |
| 363 } | 363 } |
| 364 return color_utils::GetReadableColor(color, GetColor(BACKGROUND)); | 364 return color_utils::GetReadableColor(color, GetColor(BACKGROUND)); |
| 365 } | 365 } |
| 366 | 366 |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 | 1040 |
| 1041 bool LocationBarView::ShouldShowKeywordBubble() const { | 1041 bool LocationBarView::ShouldShowKeywordBubble() const { |
| 1042 return !omnibox_view_->model()->keyword().empty() && | 1042 return !omnibox_view_->model()->keyword().empty() && |
| 1043 !omnibox_view_->model()->is_keyword_hint(); | 1043 !omnibox_view_->model()->is_keyword_hint(); |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 bool LocationBarView::ShouldShowEVBubble() const { | 1046 bool LocationBarView::ShouldShowEVBubble() const { |
| 1047 const ChromeToolbarModel* chrome_toolbar_model = | 1047 const ChromeToolbarModel* chrome_toolbar_model = |
| 1048 static_cast<const ChromeToolbarModel*>(GetToolbarModel()); | 1048 static_cast<const ChromeToolbarModel*>(GetToolbarModel()); |
| 1049 return (chrome_toolbar_model->GetSecurityLevel(false) == | 1049 return (chrome_toolbar_model->GetSecurityLevel(false) == |
| 1050 SecurityStateModel::EV_SECURE); | 1050 security_state::SecurityStateModel::EV_SECURE); |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 //////////////////////////////////////////////////////////////////////////////// | 1053 //////////////////////////////////////////////////////////////////////////////// |
| 1054 // LocationBarView, private LocationBar implementation: | 1054 // LocationBarView, private LocationBar implementation: |
| 1055 | 1055 |
| 1056 void LocationBarView::ShowFirstRunBubble() { | 1056 void LocationBarView::ShowFirstRunBubble() { |
| 1057 // Wait until search engines have loaded to show the first run bubble. | 1057 // Wait until search engines have loaded to show the first run bubble. |
| 1058 TemplateURLService* url_service = | 1058 TemplateURLService* url_service = |
| 1059 TemplateURLServiceFactory::GetForProfile(profile()); | 1059 TemplateURLServiceFactory::GetForProfile(profile()); |
| 1060 if (!url_service->loaded()) { | 1060 if (!url_service->loaded()) { |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1381 // LocationBarView, private TemplateURLServiceObserver implementation: | 1381 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1382 | 1382 |
| 1383 void LocationBarView::OnTemplateURLServiceChanged() { | 1383 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1384 template_url_service_->RemoveObserver(this); | 1384 template_url_service_->RemoveObserver(this); |
| 1385 template_url_service_ = nullptr; | 1385 template_url_service_ = nullptr; |
| 1386 // If the browser is no longer active, let's not show the info bubble, as this | 1386 // If the browser is no longer active, let's not show the info bubble, as this |
| 1387 // would make the browser the active window again. | 1387 // would make the browser the active window again. |
| 1388 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1388 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1389 ShowFirstRunBubble(); | 1389 ShowFirstRunBubble(); |
| 1390 } | 1390 } |
| OLD | NEW |