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