| 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/ui/views/omnibox/omnibox_view_views.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 model()->OnSetFocus(false); | 389 model()->OnSetFocus(false); |
| 390 // Don't call controller()->OnSetFocus as this view has already | 390 // Don't call controller()->OnSetFocus as this view has already |
| 391 // acquired the focus. | 391 // acquired the focus. |
| 392 } | 392 } |
| 393 | 393 |
| 394 void OmniboxViewViews::HandleFocusOut() { | 394 void OmniboxViewViews::HandleFocusOut() { |
| 395 gfx::NativeView native_view = NULL; | 395 gfx::NativeView native_view = NULL; |
| 396 #if defined(USE_AURA) | 396 #if defined(USE_AURA) |
| 397 views::Widget* widget = GetWidget(); | 397 views::Widget* widget = GetWidget(); |
| 398 if (widget) { | 398 if (widget) { |
| 399 aura::RootWindow* root = widget->GetNativeView()->GetRootWindow(); | 399 aura::client::FocusClient* client = |
| 400 if (root) | 400 aura::client::GetFocusClient(widget->GetNativeView()); |
| 401 native_view = root->GetFocusManager()->GetFocusedWindow(); | 401 if (client) |
| 402 native_view = client->GetFocusedWindow(); |
| 402 } | 403 } |
| 403 #endif | 404 #endif |
| 404 model()->OnWillKillFocus(native_view); | 405 model()->OnWillKillFocus(native_view); |
| 405 // Close the popup. | 406 // Close the popup. |
| 406 CloseOmniboxPopup(); | 407 CloseOmniboxPopup(); |
| 407 // Tell the model to reset itself. | 408 // Tell the model to reset itself. |
| 408 model()->OnKillFocus(); | 409 model()->OnKillFocus(); |
| 409 controller()->OnKillFocus(); | 410 controller()->OnKillFocus(); |
| 410 } | 411 } |
| 411 | 412 |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 if (!text.empty()) { | 934 if (!text.empty()) { |
| 934 // Record this paste, so we can do different behavior. | 935 // Record this paste, so we can do different behavior. |
| 935 model()->on_paste(); | 936 model()->on_paste(); |
| 936 // Force a Paste operation to trigger the text_changed code in | 937 // Force a Paste operation to trigger the text_changed code in |
| 937 // OnAfterPossibleChange(), even if identical contents are pasted into the | 938 // OnAfterPossibleChange(), even if identical contents are pasted into the |
| 938 // text box. | 939 // text box. |
| 939 text_before_change_.clear(); | 940 text_before_change_.clear(); |
| 940 textfield_->ReplaceSelection(text); | 941 textfield_->ReplaceSelection(text); |
| 941 } | 942 } |
| 942 } | 943 } |
| OLD | NEW |