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 UTF16ToWideHack( | 56 return AutocompleteInput::FormattedStringWithEquivalentMeaning(url, |
57 AutocompleteInput::FormattedStringWithEquivalentMeaning( | 57 UTF16ToWideHack(net::FormatUrl(url, languages, net::kFormatUrlOmitAll, |
58 url, | 58 UnescapeRule::NORMAL, NULL, NULL, NULL))); |
59 net::FormatUrl(url, languages, net::kFormatUrlOmitAll, | |
60 UnescapeRule::NORMAL, NULL, NULL, NULL))); | |
61 } | 59 } |
62 | 60 |
63 ToolbarModel::SecurityLevel ToolbarModel::GetSecurityLevel() const { | 61 ToolbarModel::SecurityLevel ToolbarModel::GetSecurityLevel() const { |
64 if (input_in_progress_) // When editing, assume no security style. | 62 if (input_in_progress_) // When editing, assume no security style. |
65 return NONE; | 63 return NONE; |
66 | 64 |
67 NavigationController* navigation_controller = GetNavigationController(); | 65 NavigationController* navigation_controller = GetNavigationController(); |
68 if (!navigation_controller) // We might not have a controller on init. | 66 if (!navigation_controller) // We might not have a controller on init. |
69 return NONE; | 67 return NONE; |
70 | 68 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 return UTF16ToWideHack(SSLManager::GetEVCertName(*cert)); | 120 return UTF16ToWideHack(SSLManager::GetEVCertName(*cert)); |
123 } | 121 } |
124 | 122 |
125 NavigationController* ToolbarModel::GetNavigationController() const { | 123 NavigationController* ToolbarModel::GetNavigationController() const { |
126 // This |current_tab| can be NULL during the initialization of the | 124 // This |current_tab| can be NULL during the initialization of the |
127 // toolbar during window creation (i.e. before any tabs have been added | 125 // toolbar during window creation (i.e. before any tabs have been added |
128 // to the window). | 126 // to the window). |
129 TabContents* current_tab = browser_->GetSelectedTabContents(); | 127 TabContents* current_tab = browser_->GetSelectedTabContents(); |
130 return current_tab ? ¤t_tab->controller() : NULL; | 128 return current_tab ? ¤t_tab->controller() : NULL; |
131 } | 129 } |
OLD | NEW |