OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ui/toolbar/toolbar_model.h" | 5 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/autocomplete/autocomplete.h" | 8 #include "chrome/browser/autocomplete/autocomplete.h" |
9 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 9 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
10 #include "chrome/browser/cert_store.h" | 10 #include "chrome/browser/cert_store.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 url = GURL(); | 46 url = GURL(); |
47 } else if (entry) { | 47 } else if (entry) { |
48 url = entry->virtual_url(); | 48 url = entry->virtual_url(); |
49 } | 49 } |
50 } | 50 } |
51 if (url.spec().length() > chrome::kMaxURLDisplayChars) | 51 if (url.spec().length() > chrome::kMaxURLDisplayChars) |
52 url = url.IsStandard() ? url.GetOrigin() : GURL(url.scheme() + ":"); | 52 url = url.IsStandard() ? url.GetOrigin() : GURL(url.scheme() + ":"); |
53 // Note that we can't unescape spaces here, because if the user copies this | 53 // Note that we can't unescape spaces here, because if the user copies this |
54 // and pastes it into another program, that program may think the URL ends at | 54 // and pastes it into another program, that program may think the URL ends at |
55 // the space. | 55 // the space. |
56 return AutocompleteInput::FormattedStringWithEquivalentMeaning(url, | 56 return UTF16ToWideHack( |
57 UTF16ToWideHack(net::FormatUrl(url, languages, net::kFormatUrlOmitAll, | 57 AutocompleteInput::FormattedStringWithEquivalentMeaning( |
58 UnescapeRule::NORMAL, NULL, NULL, NULL))); | 58 url, |
| 59 net::FormatUrl(url, languages, net::kFormatUrlOmitAll, |
| 60 UnescapeRule::NORMAL, NULL, NULL, NULL))); |
59 } | 61 } |
60 | 62 |
61 ToolbarModel::SecurityLevel ToolbarModel::GetSecurityLevel() const { | 63 ToolbarModel::SecurityLevel ToolbarModel::GetSecurityLevel() const { |
62 if (input_in_progress_) // When editing, assume no security style. | 64 if (input_in_progress_) // When editing, assume no security style. |
63 return NONE; | 65 return NONE; |
64 | 66 |
65 NavigationController* navigation_controller = GetNavigationController(); | 67 NavigationController* navigation_controller = GetNavigationController(); |
66 if (!navigation_controller) // We might not have a controller on init. | 68 if (!navigation_controller) // We might not have a controller on init. |
67 return NONE; | 69 return NONE; |
68 | 70 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 return UTF16ToWideHack(SSLManager::GetEVCertName(*cert)); | 122 return UTF16ToWideHack(SSLManager::GetEVCertName(*cert)); |
121 } | 123 } |
122 | 124 |
123 NavigationController* ToolbarModel::GetNavigationController() const { | 125 NavigationController* ToolbarModel::GetNavigationController() const { |
124 // This |current_tab| can be NULL during the initialization of the | 126 // This |current_tab| can be NULL during the initialization of the |
125 // toolbar during window creation (i.e. before any tabs have been added | 127 // toolbar during window creation (i.e. before any tabs have been added |
126 // to the window). | 128 // to the window). |
127 TabContents* current_tab = browser_->GetSelectedTabContents(); | 129 TabContents* current_tab = browser_->GetSelectedTabContents(); |
128 return current_tab ? ¤t_tab->controller() : NULL; | 130 return current_tab ? ¤t_tab->controller() : NULL; |
129 } | 131 } |
OLD | NEW |