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