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/instant/instant_controller.h" | 5 #include "chrome/browser/instant/instant_controller.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 321 } |
322 | 322 |
323 // We're showing instant results. As instant results may shift when | 323 // We're showing instant results. As instant results may shift when |
324 // committing we commit on the mouse up. This way a slow click still works | 324 // committing we commit on the mouse up. This way a slow click still works |
325 // fine. | 325 // fine. |
326 SetCommitOnMouseUp(); | 326 SetCommitOnMouseUp(); |
327 return; | 327 return; |
328 } | 328 } |
329 | 329 |
330 // Walk up the view hierarchy. If the view gaining focus is a subview of the | 330 // Walk up the view hierarchy. If the view gaining focus is a subview of the |
331 // TabContents view (such as a windowed plugin or http auth dialog), we want | 331 // WebContents view (such as a windowed plugin or http auth dialog), we want |
332 // to keep the preview contents. Otherwise, focus has gone somewhere else, | 332 // to keep the preview contents. Otherwise, focus has gone somewhere else, |
333 // such as the JS inspector, and we want to cancel the preview. | 333 // such as the JS inspector, and we want to cancel the preview. |
334 gfx::NativeView view_gaining_focus_ancestor = view_gaining_focus; | 334 gfx::NativeView view_gaining_focus_ancestor = view_gaining_focus; |
335 while (view_gaining_focus_ancestor && | 335 while (view_gaining_focus_ancestor && |
336 view_gaining_focus_ancestor != tab_view) { | 336 view_gaining_focus_ancestor != tab_view) { |
337 view_gaining_focus_ancestor = | 337 view_gaining_focus_ancestor = |
338 platform_util::GetParent(view_gaining_focus_ancestor); | 338 platform_util::GetParent(view_gaining_focus_ancestor); |
339 } | 339 } |
340 | 340 |
341 if (view_gaining_focus_ancestor) { | 341 if (view_gaining_focus_ancestor) { |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 if (!weak_factory_.HasWeakPtrs()) { | 528 if (!weak_factory_.HasWeakPtrs()) { |
529 MessageLoop::current()->PostTask( | 529 MessageLoop::current()->PostTask( |
530 FROM_HERE, base::Bind(&InstantController::DestroyLoaders, | 530 FROM_HERE, base::Bind(&InstantController::DestroyLoaders, |
531 weak_factory_.GetWeakPtr())); | 531 weak_factory_.GetWeakPtr())); |
532 } | 532 } |
533 } | 533 } |
534 | 534 |
535 void InstantController::DestroyLoaders() { | 535 void InstantController::DestroyLoaders() { |
536 loaders_to_destroy_.reset(); | 536 loaders_to_destroy_.reset(); |
537 } | 537 } |
OLD | NEW |