| 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" | |
| 16 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
| 17 #include "net/base/net_util.h" | 16 #include "net/base/net_util.h" |
| 18 | 17 |
| 19 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| 20 #include "chrome/browser/tab_contents/tab_contents.h" | 19 #include "chrome/browser/tab_contents/tab_contents.h" |
| 21 #elif defined(OS_POSIX) | 20 #elif defined(OS_POSIX) |
| 22 // TODO(port): remove when tab_contents is ported | 21 // TODO(port): remove when tab_contents is ported |
| 23 #include "chrome/common/temp_scaffolding_stubs.h" | 22 #include "chrome/common/temp_scaffolding_stubs.h" |
| 24 #endif | 23 #endif |
| 25 | 24 |
| 26 ToolbarModel::ToolbarModel() : input_in_progress_(false) { | 25 ToolbarModel::ToolbarModel() : input_in_progress_(false) { |
| 27 } | 26 } |
| 28 | 27 |
| 29 ToolbarModel::~ToolbarModel() { | 28 ToolbarModel::~ToolbarModel() { |
| 30 } | 29 } |
| 31 | 30 |
| 32 // ToolbarModel Implementation. | 31 // ToolbarModel Implementation. |
| 33 std::wstring ToolbarModel::GetText() { | 32 std::wstring ToolbarModel::GetText() { |
| 34 GURL url(chrome::kAboutBlankURL); | 33 static const GURL kAboutBlankURL("about:blank"); |
| 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 |