| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/toolbar/test_toolbar_model.h" | 5 #include "components/toolbar/test_toolbar_model.h" |
| 6 | 6 |
| 7 #include "components/grit/components_scaled_resources.h" | 7 #include "components/grit/components_scaled_resources.h" |
| 8 #include "ui/gfx/vector_icons_public.h" | 8 #include "ui/gfx/vector_icons_public.h" |
| 9 | 9 |
| 10 TestToolbarModel::TestToolbarModel() | 10 TestToolbarModel::TestToolbarModel() |
| 11 : perform_search_term_replacement_(false), | 11 : security_level_(security_state::SecurityStateModel::NONE), |
| 12 security_level_(security_state::SecurityStateModel::NONE), | |
| 13 #if defined(TOOLKIT_VIEWS) | 12 #if defined(TOOLKIT_VIEWS) |
| 14 icon_(gfx::VectorIconId::LOCATION_BAR_HTTP), | 13 icon_(gfx::VectorIconId::LOCATION_BAR_HTTP), |
| 15 #else | 14 #else |
| 16 icon_(gfx::VectorIconId::VECTOR_ICON_NONE), | 15 icon_(gfx::VectorIconId::VECTOR_ICON_NONE), |
| 17 #endif | 16 #endif |
| 18 should_display_url_(true) { | 17 should_display_url_(true) { |
| 19 } | 18 } |
| 20 | 19 |
| 21 TestToolbarModel::~TestToolbarModel() {} | 20 TestToolbarModel::~TestToolbarModel() {} |
| 22 | 21 |
| 23 base::string16 TestToolbarModel::GetText() const { | 22 base::string16 TestToolbarModel::GetText() const { |
| 24 return text_; | 23 return text_; |
| 25 } | 24 } |
| 26 | 25 |
| 27 base::string16 TestToolbarModel::GetFormattedURL(size_t* prefix_end) const { | 26 base::string16 TestToolbarModel::GetFormattedURL(size_t* prefix_end) const { |
| 28 return text_; | 27 return text_; |
| 29 } | 28 } |
| 30 | 29 |
| 31 GURL TestToolbarModel::GetURL() const { | 30 GURL TestToolbarModel::GetURL() const { |
| 32 return url_; | 31 return url_; |
| 33 } | 32 } |
| 34 | 33 |
| 35 bool TestToolbarModel::WouldPerformSearchTermReplacement( | |
| 36 bool ignore_editing) const { | |
| 37 return perform_search_term_replacement_; | |
| 38 } | |
| 39 | |
| 40 security_state::SecurityStateModel::SecurityLevel | 34 security_state::SecurityStateModel::SecurityLevel |
| 41 TestToolbarModel::GetSecurityLevel(bool ignore_editing) const { | 35 TestToolbarModel::GetSecurityLevel(bool ignore_editing) const { |
| 42 return security_level_; | 36 return security_level_; |
| 43 } | 37 } |
| 44 | 38 |
| 45 int TestToolbarModel::GetIcon() const { | 39 int TestToolbarModel::GetIcon() const { |
| 46 // This placeholder implementation should be removed when MD is default. | 40 // This placeholder implementation should be removed when MD is default. |
| 47 return IDR_LOCATION_BAR_HTTP; | 41 return IDR_LOCATION_BAR_HTTP; |
| 48 } | 42 } |
| 49 | 43 |
| 50 gfx::VectorIconId TestToolbarModel::GetVectorIcon() const { | 44 gfx::VectorIconId TestToolbarModel::GetVectorIcon() const { |
| 51 return icon_; | 45 return icon_; |
| 52 } | 46 } |
| 53 | 47 |
| 54 base::string16 TestToolbarModel::GetEVCertName() const { | 48 base::string16 TestToolbarModel::GetEVCertName() const { |
| 55 return (security_level_ == security_state::SecurityStateModel::EV_SECURE) | 49 return (security_level_ == security_state::SecurityStateModel::EV_SECURE) |
| 56 ? ev_cert_name_ | 50 ? ev_cert_name_ |
| 57 : base::string16(); | 51 : base::string16(); |
| 58 } | 52 } |
| 59 | 53 |
| 60 bool TestToolbarModel::ShouldDisplayURL() const { | 54 bool TestToolbarModel::ShouldDisplayURL() const { |
| 61 return should_display_url_; | 55 return should_display_url_; |
| 62 } | 56 } |
| OLD | NEW |