OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/toolbar_model.h" | 5 #include "chrome/browser/toolbar_model.h" |
6 | 6 |
7 #include "chrome/browser/cert_store.h" | 7 #include "chrome/browser/cert_store.h" |
8 #include "chrome/browser/ssl/ssl_error_info.h" | 8 #include "chrome/browser/ssl/ssl_error_info.h" |
9 #include "chrome/browser/tab_contents/navigation_controller.h" | 9 #include "chrome/browser/tab_contents/navigation_controller.h" |
10 #include "chrome/browser/tab_contents/navigation_entry.h" | 10 #include "chrome/browser/tab_contents/navigation_entry.h" |
11 #include "chrome/browser/tab_contents/tab_contents.h" | 11 #include "chrome/browser/tab_contents/tab_contents.h" |
12 #include "chrome/common/gfx/text_elider.h" | 12 #include "chrome/common/gfx/text_elider.h" |
13 #include "chrome/common/l10n_util.h" | 13 #include "chrome/common/l10n_util.h" |
14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
15 #include "chrome/common/pref_service.h" | 15 #include "chrome/common/pref_service.h" |
16 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
17 #include "net/base/net_util.h" | 17 #include "net/base/net_util.h" |
| 18 #include "webkit/glue/feed.h" |
18 | 19 |
19 | 20 |
20 ToolbarModel::ToolbarModel() : input_in_progress_(false) { | 21 ToolbarModel::ToolbarModel() : input_in_progress_(false) { |
21 } | 22 } |
22 | 23 |
23 ToolbarModel::~ToolbarModel() { | 24 ToolbarModel::~ToolbarModel() { |
24 } | 25 } |
25 | 26 |
26 // ToolbarModel Implementation. | 27 // ToolbarModel Implementation. |
27 std::wstring ToolbarModel::GetText() { | 28 std::wstring ToolbarModel::GetText() { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return ToolbarModel::WARNING_ICON; | 101 return ToolbarModel::WARNING_ICON; |
101 case SECURITY_STYLE_UNKNOWN: | 102 case SECURITY_STYLE_UNKNOWN: |
102 case SECURITY_STYLE_UNAUTHENTICATED: | 103 case SECURITY_STYLE_UNAUTHENTICATED: |
103 return ToolbarModel::NO_ICON; | 104 return ToolbarModel::NO_ICON; |
104 default: | 105 default: |
105 NOTREACHED(); | 106 NOTREACHED(); |
106 return ToolbarModel::NO_ICON; | 107 return ToolbarModel::NO_ICON; |
107 } | 108 } |
108 } | 109 } |
109 | 110 |
| 111 scoped_refptr<FeedList> ToolbarModel::GetFeedList() { |
| 112 if (input_in_progress_) |
| 113 return NULL; |
| 114 |
| 115 NavigationController* navigation_controller = GetNavigationController(); |
| 116 if (!navigation_controller) // We might not have a controller on init. |
| 117 return NULL; |
| 118 |
| 119 NavigationEntry* entry = navigation_controller->GetActiveEntry(); |
| 120 if (!entry) |
| 121 return NULL; |
| 122 |
| 123 return entry->feedlist(); |
| 124 } |
| 125 |
110 void ToolbarModel::GetIconHoverText(std::wstring* text, SkColor* text_color) { | 126 void ToolbarModel::GetIconHoverText(std::wstring* text, SkColor* text_color) { |
111 static const SkColor kOKHttpsInfoBubbleTextColor = | 127 static const SkColor kOKHttpsInfoBubbleTextColor = |
112 SkColorSetRGB(0, 153, 51); // Green. | 128 SkColorSetRGB(0, 153, 51); // Green. |
113 static const SkColor kBrokenHttpsInfoBubbleTextColor = | 129 static const SkColor kBrokenHttpsInfoBubbleTextColor = |
114 SkColorSetRGB(255, 0, 0); // Red. | 130 SkColorSetRGB(255, 0, 0); // Red. |
115 | 131 |
116 DCHECK(text && text_color); | 132 DCHECK(text && text_color); |
117 | 133 |
118 NavigationController* navigation_controller = GetNavigationController(); | 134 NavigationController* navigation_controller = GetNavigationController(); |
119 // We don't expect to be called during initialization, so the controller | 135 // We don't expect to be called during initialization, so the controller |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // Multiple errors. | 231 // Multiple errors. |
216 text->assign(l10n_util::GetString(IDS_SEVERAL_SSL_ERRORS)); | 232 text->assign(l10n_util::GetString(IDS_SEVERAL_SSL_ERRORS)); |
217 text->append(L"\n"); | 233 text->append(L"\n"); |
218 for (int i = 0; i < error_count; ++i) { | 234 for (int i = 0; i < error_count; ++i) { |
219 text->append(errors[i].short_description()); | 235 text->append(errors[i].short_description()); |
220 if (i != error_count - 1) | 236 if (i != error_count - 1) |
221 text->append(L"\n"); | 237 text->append(L"\n"); |
222 } | 238 } |
223 } | 239 } |
224 } | 240 } |
OLD | NEW |