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 { | |
24 return text_; | |
25 } | |
26 | |
27 base::string16 TestToolbarModel::GetFormattedURL(size_t* prefix_end) const { | 22 base::string16 TestToolbarModel::GetFormattedURL(size_t* prefix_end) const { |
28 return text_; | 23 return text_; |
29 } | 24 } |
30 | 25 |
31 GURL TestToolbarModel::GetURL() const { | 26 GURL TestToolbarModel::GetURL() const { |
32 return url_; | 27 return url_; |
33 } | 28 } |
34 | 29 |
35 bool TestToolbarModel::WouldPerformSearchTermReplacement( | |
36 bool ignore_editing) const { | |
37 return perform_search_term_replacement_; | |
38 } | |
39 | |
40 security_state::SecurityStateModel::SecurityLevel | 30 security_state::SecurityStateModel::SecurityLevel |
41 TestToolbarModel::GetSecurityLevel(bool ignore_editing) const { | 31 TestToolbarModel::GetSecurityLevel(bool ignore_editing) const { |
42 return security_level_; | 32 return security_level_; |
43 } | 33 } |
44 | 34 |
45 int TestToolbarModel::GetIcon() const { | 35 int TestToolbarModel::GetIcon() const { |
46 // This placeholder implementation should be removed when MD is default. | 36 // This placeholder implementation should be removed when MD is default. |
47 return IDR_LOCATION_BAR_HTTP; | 37 return IDR_LOCATION_BAR_HTTP; |
48 } | 38 } |
49 | 39 |
50 gfx::VectorIconId TestToolbarModel::GetVectorIcon() const { | 40 gfx::VectorIconId TestToolbarModel::GetVectorIcon() const { |
51 return icon_; | 41 return icon_; |
52 } | 42 } |
53 | 43 |
54 base::string16 TestToolbarModel::GetEVCertName() const { | 44 base::string16 TestToolbarModel::GetEVCertName() const { |
55 return (security_level_ == security_state::SecurityStateModel::EV_SECURE) | 45 return (security_level_ == security_state::SecurityStateModel::EV_SECURE) |
56 ? ev_cert_name_ | 46 ? ev_cert_name_ |
57 : base::string16(); | 47 : base::string16(); |
58 } | 48 } |
59 | 49 |
60 bool TestToolbarModel::ShouldDisplayURL() const { | 50 bool TestToolbarModel::ShouldDisplayURL() const { |
61 return should_display_url_; | 51 return should_display_url_; |
62 } | 52 } |
OLD | NEW |