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