Chromium Code Reviews| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 #include "ui/compositor/layer.h" | 61 #include "ui/compositor/layer.h" |
| 62 #endif | 62 #endif |
| 63 | 63 |
| 64 namespace { | 64 namespace { |
| 65 | 65 |
| 66 // Stores omnibox state for each tab. | 66 // Stores omnibox state for each tab. |
| 67 struct OmniboxState : public base::SupportsUserData::Data { | 67 struct OmniboxState : public base::SupportsUserData::Data { |
| 68 static const char kKey[]; | 68 static const char kKey[]; |
| 69 | 69 |
| 70 OmniboxState(const OmniboxEditModel::State& model_state, | 70 OmniboxState(const OmniboxEditModel::State& model_state, |
| 71 const gfx::SelectionModel& selection_model); | 71 const gfx::Range& selection, |
| 72 const gfx::Range& saved_selection_for_focus_change); | |
| 72 virtual ~OmniboxState(); | 73 virtual ~OmniboxState(); |
| 73 | 74 |
| 74 const OmniboxEditModel::State model_state; | 75 const OmniboxEditModel::State model_state; |
| 75 const gfx::SelectionModel selection_model; | 76 const gfx::Range selection; |
|
msw
2013/09/20 01:52:39
Can you explain here why two selection ranges are
Peter Kasting
2013/09/21 00:36:46
Yes. Added a description of that case.
| |
| 77 const gfx::Range saved_selection_for_focus_change; | |
| 76 }; | 78 }; |
| 77 | 79 |
| 78 // static | 80 // static |
| 79 const char OmniboxState::kKey[] = "OmniboxState"; | 81 const char OmniboxState::kKey[] = "OmniboxState"; |
| 80 | 82 |
| 81 OmniboxState::OmniboxState(const OmniboxEditModel::State& model_state, | 83 OmniboxState::OmniboxState(const OmniboxEditModel::State& model_state, |
| 82 const gfx::SelectionModel& selection_model) | 84 const gfx::Range& selection, |
| 85 const gfx::Range& saved_selection_for_focus_change) | |
| 83 : model_state(model_state), | 86 : model_state(model_state), |
| 84 selection_model(selection_model) { | 87 selection(selection), |
| 88 saved_selection_for_focus_change(saved_selection_for_focus_change) { | |
| 85 } | 89 } |
| 86 | 90 |
| 87 OmniboxState::~OmniboxState() {} | 91 OmniboxState::~OmniboxState() {} |
| 88 | 92 |
| 89 // We'd like to set the text input type to TEXT_INPUT_TYPE_URL, because this | 93 // We'd like to set the text input type to TEXT_INPUT_TYPE_URL, because this |
| 90 // triggers URL-specific layout in software keyboards, e.g. adding top-level "/" | 94 // triggers URL-specific layout in software keyboards, e.g. adding top-level "/" |
| 91 // and ".com" keys for English. However, this also causes IMEs to default to | 95 // and ".com" keys for English. However, this also causes IMEs to default to |
| 92 // Latin character mode, which makes entering search queries difficult for IME | 96 // Latin character mode, which makes entering search queries difficult for IME |
| 93 // users. Therefore, we try to guess whether an IME will be used based on the | 97 // users. Therefore, we try to guess whether an IME will be used based on the |
| 94 // application language, and set the input type accordingly. | 98 // application language, and set the input type accordingly. |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 122 OmniboxViewViews::OmniboxViewViews(OmniboxEditController* controller, | 126 OmniboxViewViews::OmniboxViewViews(OmniboxEditController* controller, |
| 123 Profile* profile, | 127 Profile* profile, |
| 124 CommandUpdater* command_updater, | 128 CommandUpdater* command_updater, |
| 125 bool popup_window_mode, | 129 bool popup_window_mode, |
| 126 LocationBarView* location_bar, | 130 LocationBarView* location_bar, |
| 127 const gfx::FontList& font_list, | 131 const gfx::FontList& font_list, |
| 128 int font_y_offset) | 132 int font_y_offset) |
| 129 : OmniboxView(profile, controller, command_updater), | 133 : OmniboxView(profile, controller, command_updater), |
| 130 popup_window_mode_(popup_window_mode), | 134 popup_window_mode_(popup_window_mode), |
| 131 security_level_(ToolbarModel::NONE), | 135 security_level_(ToolbarModel::NONE), |
| 136 saved_selection_for_focus_change_(gfx::Range::InvalidRange()), | |
| 132 ime_composing_before_change_(false), | 137 ime_composing_before_change_(false), |
| 133 delete_at_end_pressed_(false), | 138 delete_at_end_pressed_(false), |
| 134 location_bar_view_(location_bar), | 139 location_bar_view_(location_bar), |
| 135 ime_candidate_window_open_(false), | 140 ime_candidate_window_open_(false), |
| 136 select_all_on_mouse_release_(false), | 141 select_all_on_mouse_release_(false), |
| 137 select_all_on_gesture_tap_(false) { | 142 select_all_on_gesture_tap_(false) { |
| 138 RemoveBorder(); | 143 RemoveBorder(); |
| 139 set_id(VIEW_ID_OMNIBOX); | 144 set_id(VIEW_ID_OMNIBOX); |
| 140 SetFontList(font_list); | 145 SetFontList(font_list); |
| 141 SetVerticalMargins(font_y_offset, 0); | 146 SetVerticalMargins(font_y_offset, 0); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 // OmniboxViewViews, views::Textfield implementation: | 184 // OmniboxViewViews, views::Textfield implementation: |
| 180 | 185 |
| 181 const char* OmniboxViewViews::GetClassName() const { | 186 const char* OmniboxViewViews::GetClassName() const { |
| 182 return kViewClassName; | 187 return kViewClassName; |
| 183 } | 188 } |
| 184 | 189 |
| 185 void OmniboxViewViews::OnGestureEvent(ui::GestureEvent* event) { | 190 void OmniboxViewViews::OnGestureEvent(ui::GestureEvent* event) { |
| 186 views::Textfield::OnGestureEvent(event); | 191 views::Textfield::OnGestureEvent(event); |
| 187 if (!HasFocus() && event->type() == ui::ET_GESTURE_TAP_DOWN) { | 192 if (!HasFocus() && event->type() == ui::ET_GESTURE_TAP_DOWN) { |
| 188 select_all_on_gesture_tap_ = true; | 193 select_all_on_gesture_tap_ = true; |
| 194 | |
| 195 // Don't restore saved selection, it will just screw up our interaction | |
| 196 // with this edit. | |
|
msw
2013/09/20 01:52:39
nit: What is "this edit"? Do you mean the gesture
Peter Kasting
2013/09/21 00:36:46
Done.
| |
| 197 saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); | |
| 189 return; | 198 return; |
| 190 } | 199 } |
| 191 if (select_all_on_gesture_tap_ && event->type() == ui::ET_GESTURE_TAP) | 200 if (select_all_on_gesture_tap_ && event->type() == ui::ET_GESTURE_TAP) |
| 192 SelectAll(false); | 201 SelectAll(false); |
| 193 select_all_on_gesture_tap_ = false; | 202 select_all_on_gesture_tap_ = false; |
| 194 } | 203 } |
| 195 | 204 |
| 196 void OmniboxViewViews::GetAccessibleState(ui::AccessibleViewState* state) { | 205 void OmniboxViewViews::GetAccessibleState(ui::AccessibleViewState* state) { |
| 197 location_bar_view_->GetAccessibleState(state); | 206 location_bar_view_->GetAccessibleState(state); |
| 198 state->role = ui::AccessibilityTypes::ROLE_TEXT; | 207 state->role = ui::AccessibilityTypes::ROLE_TEXT; |
| 199 } | 208 } |
| 200 | 209 |
| 201 bool OmniboxViewViews::OnMousePressed(const ui::MouseEvent& event) { | 210 bool OmniboxViewViews::OnMousePressed(const ui::MouseEvent& event) { |
| 202 select_all_on_mouse_release_ = | 211 select_all_on_mouse_release_ = |
| 203 (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) && | 212 (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) && |
| 204 (!HasFocus() || (model()->focus_state() == OMNIBOX_FOCUS_INVISIBLE)); | 213 (!HasFocus() || (model()->focus_state() == OMNIBOX_FOCUS_INVISIBLE)); |
| 205 // Restore caret visibility whenever the user clicks in the omnibox in a way | 214 if (select_all_on_mouse_release_) { |
| 206 // that would give it focus. We must handle this case separately here because | 215 // Restore caret visibility whenever the user clicks in the omnibox in a way |
| 207 // if the omnibox currently has invisible focus, the mouse event won't trigger | 216 // that would give it focus. We must handle this case separately here |
| 208 // either SetFocus() or OmniboxEditModel::OnSetFocus(). | 217 // because if the omnibox currently has invisible focus, the mouse event |
| 209 if (select_all_on_mouse_release_) | 218 // won't trigger either SetFocus() or OmniboxEditModel::OnSetFocus(). |
| 210 model()->SetCaretVisibility(true); | 219 model()->SetCaretVisibility(true); |
| 220 | |
| 221 // Don't restore saved selection, it will just screw up our interaction | |
| 222 // with this edit. | |
|
msw
2013/09/20 01:52:39
nit: ditto to comment clarity and value.
Peter Kasting
2013/09/21 00:36:46
Done.
| |
| 223 saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); | |
| 224 } | |
| 211 return views::Textfield::OnMousePressed(event); | 225 return views::Textfield::OnMousePressed(event); |
| 212 } | 226 } |
| 213 | 227 |
| 214 bool OmniboxViewViews::OnMouseDragged(const ui::MouseEvent& event) { | 228 bool OmniboxViewViews::OnMouseDragged(const ui::MouseEvent& event) { |
| 215 select_all_on_mouse_release_ = false; | 229 select_all_on_mouse_release_ = false; |
| 216 return views::Textfield::OnMouseDragged(event); | 230 return views::Textfield::OnMouseDragged(event); |
| 217 } | 231 } |
| 218 | 232 |
| 219 void OmniboxViewViews::OnMouseReleased(const ui::MouseEvent& event) { | 233 void OmniboxViewViews::OnMouseReleased(const ui::MouseEvent& event) { |
| 220 views::Textfield::OnMouseReleased(event); | 234 views::Textfield::OnMouseReleased(event); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 | 336 |
| 323 return Textfield::SkipDefaultKeyEventProcessing(event); | 337 return Textfield::SkipDefaultKeyEventProcessing(event); |
| 324 } | 338 } |
| 325 | 339 |
| 326 void OmniboxViewViews::OnFocus() { | 340 void OmniboxViewViews::OnFocus() { |
| 327 views::Textfield::OnFocus(); | 341 views::Textfield::OnFocus(); |
| 328 // TODO(oshima): Get control key state. | 342 // TODO(oshima): Get control key state. |
| 329 model()->OnSetFocus(false); | 343 model()->OnSetFocus(false); |
| 330 // Don't call controller()->OnSetFocus, this view has already acquired focus. | 344 // Don't call controller()->OnSetFocus, this view has already acquired focus. |
| 331 | 345 |
| 332 // Restore a valid saved selection on tab-to-focus. | 346 // Restore saved selection if available. |
|
msw
2013/09/20 01:52:39
nit: consider "Restore the saved selection from On
Peter Kasting
2013/09/21 00:36:46
Done.
| |
| 333 if (location_bar_view_->GetWebContents() && !select_all_on_mouse_release_) { | 347 if (saved_selection_for_focus_change_.IsValid()) { |
| 334 const OmniboxState* state = static_cast<OmniboxState*>( | 348 SelectRange(saved_selection_for_focus_change_); |
| 335 location_bar_view_->GetWebContents()->GetUserData(&OmniboxState::kKey)); | 349 saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); |
| 336 if (state) | |
| 337 SelectSelectionModel(state->selection_model); | |
| 338 } | 350 } |
| 339 } | 351 } |
| 340 | 352 |
| 341 void OmniboxViewViews::OnBlur() { | 353 void OmniboxViewViews::OnBlur() { |
| 342 // Save the selection to restore on tab-to-focus. | 354 // Save the user's existing selection to restore it later. |
| 343 if (location_bar_view_->GetWebContents()) | 355 saved_selection_for_focus_change_ = GetSelectedRange(); |
| 344 SaveStateToTab(location_bar_view_->GetWebContents()); | |
| 345 | 356 |
| 346 views::Textfield::OnBlur(); | 357 views::Textfield::OnBlur(); |
| 347 gfx::NativeView native_view = NULL; | 358 gfx::NativeView native_view = NULL; |
| 348 #if defined(USE_AURA) | 359 #if defined(USE_AURA) |
| 349 views::Widget* widget = GetWidget(); | 360 views::Widget* widget = GetWidget(); |
| 350 if (widget) { | 361 if (widget) { |
| 351 aura::client::FocusClient* client = | 362 aura::client::FocusClient* client = |
| 352 aura::client::GetFocusClient(widget->GetNativeView()); | 363 aura::client::GetFocusClient(widget->GetNativeView()); |
| 353 if (client) | 364 if (client) |
| 354 native_view = client->GetFocusedWindow(); | 365 native_view = client->GetFocusedWindow(); |
| 355 } | 366 } |
| 356 #endif | 367 #endif |
| 357 model()->OnWillKillFocus(native_view); | 368 model()->OnWillKillFocus(native_view); |
| 358 // Close the popup. | 369 // Close the popup. |
| 359 CloseOmniboxPopup(); | 370 CloseOmniboxPopup(); |
| 371 | |
| 360 // Tell the model to reset itself. | 372 // Tell the model to reset itself. |
| 361 model()->OnKillFocus(); | 373 model()->OnKillFocus(); |
| 362 controller()->OnKillFocus(); | 374 controller()->OnKillFocus(); |
| 363 | 375 |
| 364 // Make sure the beginning of the text is visible. | 376 // Make sure the beginning of the text is visible. |
| 365 SelectRange(gfx::Range(0)); | 377 SelectRange(gfx::Range(0)); |
| 366 } | 378 } |
| 367 | 379 |
| 368 //////////////////////////////////////////////////////////////////////////////// | 380 //////////////////////////////////////////////////////////////////////////////// |
| 369 // OmniboxViewViews, OmniboxView implementation: | 381 // OmniboxViewViews, OmniboxView implementation: |
| 370 | 382 |
| 371 void OmniboxViewViews::SaveStateToTab(content::WebContents* tab) { | 383 void OmniboxViewViews::SaveStateToTab(content::WebContents* tab) { |
| 372 DCHECK(tab); | 384 DCHECK(tab); |
| 373 | 385 |
| 374 // We don't want to keep the IME status, so force quit the current | 386 // We don't want to keep the IME status, so force quit the current |
| 375 // session here. It may affect the selection status, so order is | 387 // session here. It may affect the selection status, so order is |
| 376 // also important. | 388 // also important. |
| 377 if (IsIMEComposing()) { | 389 if (IsIMEComposing()) { |
| 378 GetTextInputClient()->ConfirmCompositionText(); | 390 GetTextInputClient()->ConfirmCompositionText(); |
| 379 GetInputMethod()->CancelComposition(this); | 391 GetInputMethod()->CancelComposition(this); |
| 380 } | 392 } |
| 381 | 393 |
| 382 // NOTE: GetStateForTabSwitch may affect GetSelection, so order is important. | 394 // NOTE: GetStateForTabSwitch() may affect GetSelectedRange(), so order is |
| 395 // important. | |
| 383 OmniboxEditModel::State state = model()->GetStateForTabSwitch(); | 396 OmniboxEditModel::State state = model()->GetStateForTabSwitch(); |
| 384 const gfx::SelectionModel selection = GetSelectionModel(); | 397 tab->SetUserData(OmniboxState::kKey, new OmniboxState( |
| 385 tab->SetUserData(OmniboxState::kKey, new OmniboxState(state, selection)); | 398 state, GetSelectedRange(), saved_selection_for_focus_change_)); |
| 386 } | 399 } |
| 387 | 400 |
| 388 void OmniboxViewViews::OnTabChanged(const content::WebContents* web_contents) { | 401 void OmniboxViewViews::OnTabChanged(const content::WebContents* web_contents) { |
| 389 security_level_ = controller()->GetToolbarModel()->GetSecurityLevel(false); | 402 security_level_ = controller()->GetToolbarModel()->GetSecurityLevel(false); |
| 390 | 403 |
| 391 const OmniboxState* state = static_cast<OmniboxState*>( | 404 const OmniboxState* state = static_cast<OmniboxState*>( |
| 392 web_contents->GetUserData(&OmniboxState::kKey)); | 405 web_contents->GetUserData(&OmniboxState::kKey)); |
| 393 model()->RestoreState(state ? &state->model_state : NULL); | 406 model()->RestoreState(state ? &state->model_state : NULL); |
| 394 if (state) | 407 if (state) { |
| 395 SelectSelectionModel(state->selection_model); | 408 SelectRange(state->selection); |
| 409 saved_selection_for_focus_change_ = state->saved_selection_for_focus_change; | |
| 410 } | |
| 396 | 411 |
| 397 // TODO(msw|oshima): Consider saving/restoring edit history. | 412 // TODO(msw|oshima): Consider saving/restoring edit history. |
| 398 ClearEditHistory(); | 413 ClearEditHistory(); |
| 399 } | 414 } |
| 400 | 415 |
| 401 void OmniboxViewViews::Update() { | 416 void OmniboxViewViews::Update() { |
| 402 const ToolbarModel::SecurityLevel old_security_level = security_level_; | 417 const ToolbarModel::SecurityLevel old_security_level = security_level_; |
| 403 security_level_ = controller()->GetToolbarModel()->GetSecurityLevel(false); | 418 security_level_ = controller()->GetToolbarModel()->GetSecurityLevel(false); |
| 404 if (model()->UpdatePermanentText()) { | 419 if (model()->UpdatePermanentText()) { |
| 405 // Something visibly changed. Re-enable search term replacement. | 420 // Something visibly changed. Re-enable search term replacement. |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 429 } else if (old_security_level != security_level_) { | 444 } else if (old_security_level != security_level_) { |
| 430 EmphasizeURLComponents(); | 445 EmphasizeURLComponents(); |
| 431 } | 446 } |
| 432 } | 447 } |
| 433 | 448 |
| 434 string16 OmniboxViewViews::GetText() const { | 449 string16 OmniboxViewViews::GetText() const { |
| 435 // TODO(oshima): IME support | 450 // TODO(oshima): IME support |
| 436 return text(); | 451 return text(); |
| 437 } | 452 } |
| 438 | 453 |
| 454 void OmniboxViewViews::SetUserText(const string16& text, | |
| 455 const string16& display_text, | |
| 456 bool update_popup) { | |
| 457 saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); | |
| 458 OmniboxView::SetUserText(text, display_text, update_popup); | |
| 459 } | |
| 460 | |
| 439 void OmniboxViewViews::SetWindowTextAndCaretPos(const string16& text, | 461 void OmniboxViewViews::SetWindowTextAndCaretPos(const string16& text, |
| 440 size_t caret_pos, | 462 size_t caret_pos, |
| 441 bool update_popup, | 463 bool update_popup, |
| 442 bool notify_text_changed) { | 464 bool notify_text_changed) { |
| 443 const gfx::Range range(caret_pos, caret_pos); | 465 const gfx::Range range(caret_pos, caret_pos); |
| 444 SetTextAndSelectedRange(text, range); | 466 SetTextAndSelectedRange(text, range); |
| 445 | 467 |
| 446 if (update_popup) | 468 if (update_popup) |
| 447 UpdatePopup(); | 469 UpdatePopup(); |
| 448 | 470 |
| 449 if (notify_text_changed) | 471 if (notify_text_changed) |
| 450 TextChanged(); | 472 TextChanged(); |
| 451 } | 473 } |
| 452 | 474 |
| 453 void OmniboxViewViews::SetForcedQuery() { | 475 void OmniboxViewViews::SetForcedQuery() { |
| 454 const string16 current_text(text()); | 476 const string16 current_text(text()); |
| 455 const size_t start = current_text.find_first_not_of(kWhitespaceUTF16); | 477 const size_t start = current_text.find_first_not_of(kWhitespaceUTF16); |
| 456 if (start == string16::npos || (current_text[start] != '?')) | 478 if (start == string16::npos || (current_text[start] != '?')) |
| 457 SetUserText(ASCIIToUTF16("?")); | 479 OmniboxView::SetUserText(ASCIIToUTF16("?")); |
|
msw
2013/09/20 01:52:39
Yuck, an overload! (no action item...)
Peter Kasting
2013/09/21 00:36:46
Yeah. I find this intensely annoying :(
| |
| 458 else | 480 else |
| 459 SelectRange(gfx::Range(current_text.size(), start + 1)); | 481 SelectRange(gfx::Range(current_text.size(), start + 1)); |
| 460 } | 482 } |
| 461 | 483 |
| 462 bool OmniboxViewViews::IsSelectAll() const { | 484 bool OmniboxViewViews::IsSelectAll() const { |
| 463 // TODO(oshima): IME support. | 485 // TODO(oshima): IME support. |
| 464 return text() == GetSelectedText(); | 486 return text() == GetSelectedText(); |
| 465 } | 487 } |
| 466 | 488 |
| 467 bool OmniboxViewViews::DeleteAtEndPressed() { | 489 bool OmniboxViewViews::DeleteAtEndPressed() { |
| 468 return delete_at_end_pressed_; | 490 return delete_at_end_pressed_; |
| 469 } | 491 } |
| 470 | 492 |
| 471 void OmniboxViewViews::GetSelectionBounds(string16::size_type* start, | 493 void OmniboxViewViews::GetSelectionBounds(string16::size_type* start, |
| 472 string16::size_type* end) const { | 494 string16::size_type* end) const { |
| 473 const gfx::Range range = GetSelectedRange(); | 495 const gfx::Range range = GetSelectedRange(); |
| 474 *start = static_cast<size_t>(range.start()); | 496 *start = static_cast<size_t>(range.start()); |
| 475 *end = static_cast<size_t>(range.end()); | 497 *end = static_cast<size_t>(range.end()); |
| 476 } | 498 } |
| 477 | 499 |
| 478 void OmniboxViewViews::SelectAll(bool reversed) { | 500 void OmniboxViewViews::SelectAll(bool reversed) { |
| 479 views::Textfield::SelectAll(reversed); | 501 views::Textfield::SelectAll(reversed); |
| 480 } | 502 } |
| 481 | 503 |
| 504 void OmniboxViewViews::RevertAll() { | |
| 505 saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); | |
| 506 OmniboxView::RevertAll(); | |
| 507 } | |
| 508 | |
| 482 void OmniboxViewViews::UpdatePopup() { | 509 void OmniboxViewViews::UpdatePopup() { |
| 483 model()->SetInputInProgress(true); | 510 model()->SetInputInProgress(true); |
| 484 if (!model()->has_focus()) | 511 if (!model()->has_focus()) |
| 485 return; | 512 return; |
| 486 | 513 |
| 487 // Hide the inline autocompletion for IME users. | 514 // Hide the inline autocompletion for IME users. |
| 488 location_bar_view_->SetImeInlineAutocompletion(string16()); | 515 location_bar_view_->SetImeInlineAutocompletion(string16()); |
| 489 | 516 |
| 490 // Prevent inline autocomplete when the caret isn't at the end of the text, | 517 // Prevent inline autocomplete when the caret isn't at the end of the text, |
| 491 // and during IME composition editing unless | 518 // and during IME composition editing unless |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 920 const string16 text(GetClipboardText()); | 947 const string16 text(GetClipboardText()); |
| 921 if (!text.empty()) { | 948 if (!text.empty()) { |
| 922 // Record this paste, so we can do different behavior. | 949 // Record this paste, so we can do different behavior. |
| 923 model()->on_paste(); | 950 model()->on_paste(); |
| 924 // Force a Paste operation to trigger the text_changed code in | 951 // Force a Paste operation to trigger the text_changed code in |
| 925 // OnAfterPossibleChange(), even if identical contents are pasted. | 952 // OnAfterPossibleChange(), even if identical contents are pasted. |
| 926 text_before_change_.clear(); | 953 text_before_change_.clear(); |
| 927 InsertOrReplaceText(text); | 954 InsertOrReplaceText(text); |
| 928 } | 955 } |
| 929 } | 956 } |
| OLD | NEW |