OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // of view-source:chrome://newtab, which should display its URL despite what | 70 // of view-source:chrome://newtab, which should display its URL despite what |
71 // chrome://newtab's WebUI says. | 71 // chrome://newtab's WebUI says. |
72 NavigationController* controller = GetNavigationController(); | 72 NavigationController* controller = GetNavigationController(); |
73 NavigationEntry* entry = controller ? controller->GetVisibleEntry() : NULL; | 73 NavigationEntry* entry = controller ? controller->GetVisibleEntry() : NULL; |
74 if (entry) { | 74 if (entry) { |
75 if (entry->IsViewSourceMode() || entry->page_type() == INTERSTITIAL_PAGE) | 75 if (entry->IsViewSourceMode() || entry->page_type() == INTERSTITIAL_PAGE) |
76 return true; | 76 return true; |
77 } | 77 } |
78 | 78 |
79 TabContents* tab_contents = browser_->GetSelectedTabContents(); | 79 TabContents* tab_contents = browser_->GetSelectedTabContents(); |
80 if (tab_contents && tab_contents->web_ui()) | 80 if (tab_contents && tab_contents->GetWebUIForCurrentState()) |
81 return !tab_contents->web_ui()->should_hide_url(); | 81 return !tab_contents->GetWebUIForCurrentState()->should_hide_url(); |
82 | 82 |
83 if (entry && entry->url().SchemeIs(chrome::kExtensionScheme)) | 83 if (entry && entry->url().SchemeIs(chrome::kExtensionScheme)) |
84 return false; | 84 return false; |
85 | 85 |
86 return true; | 86 return true; |
87 } | 87 } |
88 | 88 |
89 ToolbarModel::SecurityLevel ToolbarModel::GetSecurityLevel() const { | 89 ToolbarModel::SecurityLevel ToolbarModel::GetSecurityLevel() const { |
90 if (input_in_progress_) // When editing, assume no security style. | 90 if (input_in_progress_) // When editing, assume no security style. |
91 return NONE; | 91 return NONE; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 UTF8ToUTF16(cert.subject().country_name)); | 163 UTF8ToUTF16(cert.subject().country_name)); |
164 } | 164 } |
165 | 165 |
166 NavigationController* ToolbarModel::GetNavigationController() const { | 166 NavigationController* ToolbarModel::GetNavigationController() const { |
167 // This |current_tab| can be NULL during the initialization of the | 167 // This |current_tab| can be NULL during the initialization of the |
168 // toolbar during window creation (i.e. before any tabs have been added | 168 // toolbar during window creation (i.e. before any tabs have been added |
169 // to the window). | 169 // to the window). |
170 TabContents* current_tab = browser_->GetSelectedTabContents(); | 170 TabContents* current_tab = browser_->GetSelectedTabContents(); |
171 return current_tab ? ¤t_tab->controller() : NULL; | 171 return current_tab ? ¤t_tab->controller() : NULL; |
172 } | 172 } |
OLD | NEW |