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/common/gfx/text_elider.h" | 11 #include "chrome/common/gfx/text_elider.h" |
12 #include "chrome/common/l10n_util.h" | 12 #include "chrome/common/l10n_util.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
14 #include "chrome/common/pref_service.h" | 14 #include "chrome/common/pref_service.h" |
| 15 #include "chrome/common/url_constants.h" |
15 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
16 #include "net/base/net_util.h" | 17 #include "net/base/net_util.h" |
17 | 18 |
18 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
19 #include "chrome/browser/tab_contents/tab_contents.h" | 20 #include "chrome/browser/tab_contents/tab_contents.h" |
20 #elif defined(OS_POSIX) | 21 #elif defined(OS_POSIX) |
21 // TODO(port): remove when tab_contents is ported | 22 // TODO(port): remove when tab_contents is ported |
22 #include "chrome/common/temp_scaffolding_stubs.h" | 23 #include "chrome/common/temp_scaffolding_stubs.h" |
23 #endif | 24 #endif |
24 | 25 |
25 ToolbarModel::ToolbarModel() : input_in_progress_(false) { | 26 ToolbarModel::ToolbarModel() : input_in_progress_(false) { |
26 } | 27 } |
27 | 28 |
28 ToolbarModel::~ToolbarModel() { | 29 ToolbarModel::~ToolbarModel() { |
29 } | 30 } |
30 | 31 |
31 // ToolbarModel Implementation. | 32 // ToolbarModel Implementation. |
32 std::wstring ToolbarModel::GetText() { | 33 std::wstring ToolbarModel::GetText() { |
33 static const GURL kAboutBlankURL("about:blank"); | 34 GURL url(chrome::kAboutBlankURL); |
34 GURL url(kAboutBlankURL); | |
35 std::wstring languages; // Empty if we don't have a |navigation_controller|. | 35 std::wstring languages; // Empty if we don't have a |navigation_controller|. |
36 | 36 |
37 NavigationController* navigation_controller = GetNavigationController(); | 37 NavigationController* navigation_controller = GetNavigationController(); |
38 if (navigation_controller) { | 38 if (navigation_controller) { |
39 languages = navigation_controller->profile()->GetPrefs()->GetString( | 39 languages = navigation_controller->profile()->GetPrefs()->GetString( |
40 prefs::kAcceptLanguages); | 40 prefs::kAcceptLanguages); |
41 NavigationEntry* entry = navigation_controller->GetActiveEntry(); | 41 NavigationEntry* entry = navigation_controller->GetActiveEntry(); |
42 // We may not have a navigation entry yet | 42 // We may not have a navigation entry yet |
43 if (!navigation_controller->active_contents()->ShouldDisplayURL()) { | 43 if (!navigation_controller->active_contents()->ShouldDisplayURL()) { |
44 // Explicitly hide the URL for this tab. | 44 // Explicitly hide the URL for this tab. |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 text->assign(l10n_util::GetString(IDS_SEVERAL_SSL_ERRORS)); | 221 text->assign(l10n_util::GetString(IDS_SEVERAL_SSL_ERRORS)); |
222 text->append(L"\n"); | 222 text->append(L"\n"); |
223 for (int i = 0; i < error_count; ++i) { | 223 for (int i = 0; i < error_count; ++i) { |
224 text->append(errors[i].short_description()); | 224 text->append(errors[i].short_description()); |
225 if (i != error_count - 1) | 225 if (i != error_count - 1) |
226 text->append(L"\n"); | 226 text->append(L"\n"); |
227 } | 227 } |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
OLD | NEW |