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/dom_ui/dom_ui_contents.h" | 5 #include "chrome/browser/dom_ui/dom_ui_contents.h" |
6 | 6 |
7 #include "chrome/browser/debugger/debugger_contents.h" | 7 #include "chrome/browser/debugger/debugger_contents.h" |
8 #include "chrome/browser/dom_ui/dev_tools_ui.h" | 8 #include "chrome/browser/dom_ui/dev_tools_ui.h" |
9 #include "chrome/browser/dom_ui/dom_ui.h" | 9 #include "chrome/browser/dom_ui/dom_ui.h" |
10 #include "chrome/browser/dom_ui/downloads_ui.h" | 10 #include "chrome/browser/dom_ui/downloads_ui.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 bool DOMUIContents::IsBookmarkBarAlwaysVisible() { | 188 bool DOMUIContents::IsBookmarkBarAlwaysVisible() { |
189 if (InitCurrentUI(false)) | 189 if (InitCurrentUI(false)) |
190 return current_ui_->IsBookmarkBarAlwaysVisible(); | 190 return current_ui_->IsBookmarkBarAlwaysVisible(); |
191 return false; | 191 return false; |
192 } | 192 } |
193 | 193 |
194 void DOMUIContents::SetInitialFocus() { | 194 void DOMUIContents::SetInitialFocus() { |
195 if (InitCurrentUI(false)) | 195 if (InitCurrentUI(false)) |
196 current_ui_->SetInitialFocus(); | 196 current_ui_->SetInitialFocus(); |
197 else | 197 else if (current_ui_) |
198 current_ui_->get_contents()->view()->SetInitialFocus(); | 198 current_ui_->get_contents()->view()->SetInitialFocus(); |
199 } | 199 } |
200 | 200 |
201 const string16& DOMUIContents::GetTitle() const { | 201 const string16& DOMUIContents::GetTitle() const { |
202 // Workaround for new tab page - we may be asked for a title before | 202 // Workaround for new tab page - we may be asked for a title before |
203 // the content is ready, and we don't even want to display a 'loading...' | 203 // the content is ready, and we don't even want to display a 'loading...' |
204 // message, so we force it here. | 204 // message, so we force it here. |
205 if (controller()->GetActiveEntry() && | 205 if (controller()->GetActiveEntry() && |
206 controller()->GetActiveEntry()->url().host() == | 206 controller()->GetActiveEntry()->url().host() == |
207 NewTabUI::GetBaseURL().host()) { | 207 NewTabUI::GetBaseURL().host()) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 if (reload || url.host() != current_url_.host()) { | 250 if (reload || url.host() != current_url_.host()) { |
251 // Shut down our existing DOMUI. | 251 // Shut down our existing DOMUI. |
252 delete current_ui_; | 252 delete current_ui_; |
253 current_ui_ = NULL; | 253 current_ui_ = NULL; |
254 | 254 |
255 // Set up a new DOMUI. | 255 // Set up a new DOMUI. |
256 current_ui_ = GetDOMUIForURL(url); | 256 current_ui_ = GetDOMUIForURL(url); |
257 if (current_ui_) { | 257 if (current_ui_) { |
258 current_ui_->Init(); | 258 current_ui_->Init(); |
259 current_url_ = url; | 259 current_url_ = url; |
260 return true; | |
261 } | 260 } |
262 } else if (current_ui_) { | 261 } |
| 262 |
| 263 if (current_ui_) |
263 return true; | 264 return true; |
264 } | |
265 | 265 |
266 return false; | 266 return false; |
267 } | 267 } |
268 | 268 |
269 // static | 269 // static |
270 const std::string DOMUIContents::GetScheme() { | 270 const std::string DOMUIContents::GetScheme() { |
271 return chrome::kChromeUIScheme; | 271 return chrome::kChromeUIScheme; |
272 } | 272 } |
273 | 273 |
274 DOMUI* DOMUIContents::GetDOMUIForURL(const GURL &url) { | 274 DOMUI* DOMUIContents::GetDOMUIForURL(const GURL &url) { |
(...skipping 16 matching lines...) Expand all Loading... |
291 return new DebuggerContents(this); | 291 return new DebuggerContents(this); |
292 } | 292 } |
293 if (url.host() == DevToolsUI::GetBaseURL().host()) { | 293 if (url.host() == DevToolsUI::GetBaseURL().host()) { |
294 return new DevToolsUI(this); | 294 return new DevToolsUI(this); |
295 } | 295 } |
296 #else | 296 #else |
297 NOTIMPLEMENTED(); | 297 NOTIMPLEMENTED(); |
298 #endif | 298 #endif |
299 return NULL; | 299 return NULL; |
300 } | 300 } |
OLD | NEW |