| 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 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" | 5 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 - (void)willBecomeUnselectedTab { | 265 - (void)willBecomeUnselectedTab { |
| 266 // The RWHV is ripped out of the view hierarchy on tab switches, so it never | 266 // The RWHV is ripped out of the view hierarchy on tab switches, so it never |
| 267 // formally resigns first responder status. Handle this by explicitly sending | 267 // formally resigns first responder status. Handle this by explicitly sending |
| 268 // a Blur() message to the renderer, but only if the RWHV currently has focus. | 268 // a Blur() message to the renderer, but only if the RWHV currently has focus. |
| 269 content::RenderViewHost* rvh = [self webContents]->GetRenderViewHost(); | 269 content::RenderViewHost* rvh = [self webContents]->GetRenderViewHost(); |
| 270 if (rvh) { | 270 if (rvh) { |
| 271 if (rvh->GetView() && rvh->GetView()->HasFocus()) { | 271 if (rvh->GetView() && rvh->GetView()->HasFocus()) { |
| 272 rvh->Blur(); | 272 rvh->Blur(); |
| 273 return; | 273 return; |
| 274 } | 274 } |
| 275 DevToolsWindow* devtoolsWindow = | 275 WebContents* devtools = DevToolsWindow::GetWebContentsToShowForInspectedTab( |
| 276 DevToolsWindow::GetDockedInstanceForInspectedTab([self webContents]); | 276 [self webContents], NULL); |
| 277 if (devtoolsWindow) { | 277 if (devtools) { |
| 278 content::RenderViewHost* devtoolsView = | 278 content::RenderViewHost* devtoolsView = devtools->GetRenderViewHost(); |
| 279 devtoolsWindow->web_contents()->GetRenderViewHost(); | |
| 280 if (devtoolsView && devtoolsView->GetView() && | 279 if (devtoolsView && devtoolsView->GetView() && |
| 281 devtoolsView->GetView()->HasFocus()) { | 280 devtoolsView->GetView()->HasFocus()) { |
| 282 devtoolsView->Blur(); | 281 devtoolsView->Blur(); |
| 283 } | 282 } |
| 284 } | 283 } |
| 285 } | 284 } |
| 286 } | 285 } |
| 287 | 286 |
| 288 - (void)willBecomeSelectedTab { | 287 - (void)willBecomeSelectedTab { |
| 289 // Do not explicitly call Focus() here, as the RWHV may not actually have | 288 // Do not explicitly call Focus() here, as the RWHV may not actually have |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } else { | 356 } else { |
| 358 rect.ClampToCenteredSize(gfx::Size( | 357 rect.ClampToCenteredSize(gfx::Size( |
| 359 static_cast<int>(x / captureSize.height()), rect.height())); | 358 static_cast<int>(x / captureSize.height()), rect.height())); |
| 360 } | 359 } |
| 361 } | 360 } |
| 362 | 361 |
| 363 return NSRectFromCGRect(rect.ToCGRect()); | 362 return NSRectFromCGRect(rect.ToCGRect()); |
| 364 } | 363 } |
| 365 | 364 |
| 366 @end | 365 @end |
| OLD | NEW |