| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tab_contents/chrome_web_contents_view_delegate_views.h" | 5 #include "chrome/browser/tab_contents/chrome_web_contents_view_delegate_views.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_shutdown.h" | 7 #include "chrome/browser/browser_shutdown.h" |
| 8 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 8 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
| 9 #include "chrome/browser/ui/sad_tab_helper.h" | 9 #include "chrome/browser/ui/sad_tab_helper.h" |
| 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 bool ChromeWebContentsViewDelegateViews::Focus() { | 59 bool ChromeWebContentsViewDelegateViews::Focus() { |
| 60 TabContentsWrapper* wrapper = | 60 TabContentsWrapper* wrapper = |
| 61 TabContentsWrapper::GetCurrentWrapperForContents(web_contents_); | 61 TabContentsWrapper::GetCurrentWrapperForContents(web_contents_); |
| 62 if (wrapper) { | 62 if (wrapper) { |
| 63 views::Widget* sad_tab = wrapper->sad_tab_helper()->sad_tab(); | 63 views::Widget* sad_tab = wrapper->sad_tab_helper()->sad_tab(); |
| 64 if (sad_tab) { | 64 if (sad_tab) { |
| 65 sad_tab->GetContentsView()->RequestFocus(); | 65 sad_tab->GetContentsView()->RequestFocus(); |
| 66 return true; | 66 return true; |
| 67 } | 67 } |
| 68 | 68 |
| 69 // TODO(erg): TabContents used to own constrained windows, which is why | 69 // TODO(erg): WebContents used to own constrained windows, which is why |
| 70 // this is here. Eventually this should be ported to a containing view | 70 // this is here. Eventually this should be ported to a containing view |
| 71 // specializing in constrained window management. | 71 // specializing in constrained window management. |
| 72 ConstrainedWindowTabHelper* helper = | 72 ConstrainedWindowTabHelper* helper = |
| 73 wrapper->constrained_window_tab_helper(); | 73 wrapper->constrained_window_tab_helper(); |
| 74 if (helper->constrained_window_count() > 0) { | 74 if (helper->constrained_window_count() > 0) { |
| 75 ConstrainedWindow* window = *helper->constrained_window_begin(); | 75 ConstrainedWindow* window = *helper->constrained_window_begin(); |
| 76 DCHECK(window); | 76 DCHECK(window); |
| 77 window->FocusConstrainedWindow(); | 77 window->FocusConstrainedWindow(); |
| 78 return true; | 78 return true; |
| 79 } | 79 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 return toplevel_widget ? toplevel_widget->GetFocusManager() : NULL; | 172 return toplevel_widget ? toplevel_widget->GetFocusManager() : NULL; |
| 173 } | 173 } |
| 174 | 174 |
| 175 void ChromeWebContentsViewDelegateViews::SetInitialFocus() { | 175 void ChromeWebContentsViewDelegateViews::SetInitialFocus() { |
| 176 if (web_contents_->FocusLocationBarByDefault()) { | 176 if (web_contents_->FocusLocationBarByDefault()) { |
| 177 web_contents_->SetFocusToLocationBar(false); | 177 web_contents_->SetFocusToLocationBar(false); |
| 178 } else { | 178 } else { |
| 179 web_contents_->GetView()->Focus(); | 179 web_contents_->GetView()->Focus(); |
| 180 } | 180 } |
| 181 } | 181 } |
| OLD | NEW |