| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/autocomplete/autocomplete_edit_view_gtk.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 return model_->user_input_in_progress() || | 424 return model_->user_input_in_progress() || |
| 425 (gtk_text_buffer_get_char_count(text_buffer_) == 0); | 425 (gtk_text_buffer_get_char_count(text_buffer_) == 0); |
| 426 } | 426 } |
| 427 | 427 |
| 428 int AutocompleteEditViewGtk::GetIcon() const { | 428 int AutocompleteEditViewGtk::GetIcon() const { |
| 429 return IsEditingOrEmpty() ? | 429 return IsEditingOrEmpty() ? |
| 430 AutocompleteMatch::TypeToIcon(model_->CurrentTextType()) : | 430 AutocompleteMatch::TypeToIcon(model_->CurrentTextType()) : |
| 431 toolbar_model_->GetIcon(); | 431 toolbar_model_->GetIcon(); |
| 432 } | 432 } |
| 433 | 433 |
| 434 void AutocompleteEditViewGtk::SetUserText(const std::wstring& text) { |
| 435 SetUserText(text, text, true); |
| 436 } |
| 437 |
| 434 void AutocompleteEditViewGtk::SetUserText(const std::wstring& text, | 438 void AutocompleteEditViewGtk::SetUserText(const std::wstring& text, |
| 435 const std::wstring& display_text, | 439 const std::wstring& display_text, |
| 436 bool update_popup) { | 440 bool update_popup) { |
| 437 model_->SetUserText(text); | 441 model_->SetUserText(text); |
| 438 // TODO(deanm): something about selection / focus change here. | 442 // TODO(deanm): something about selection / focus change here. |
| 439 SetWindowTextAndCaretPos(display_text, display_text.length()); | 443 SetWindowTextAndCaretPos(display_text, display_text.length()); |
| 440 if (update_popup) | 444 if (update_popup) |
| 441 UpdatePopup(); | 445 UpdatePopup(); |
| 442 TextChanged(); | 446 TextChanged(); |
| 443 } | 447 } |
| (...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 CharRange selection = GetSelection(); | 1597 CharRange selection = GetSelection(); |
| 1594 GURL url; | 1598 GURL url; |
| 1595 bool write_url; | 1599 bool write_url; |
| 1596 model_->AdjustTextForCopy(selection.selection_min(), IsSelectAll(), &text, | 1600 model_->AdjustTextForCopy(selection.selection_min(), IsSelectAll(), &text, |
| 1597 &url, &write_url); | 1601 &url, &write_url); |
| 1598 if (write_url) { | 1602 if (write_url) { |
| 1599 selected_text_ = WideToUTF8(text); | 1603 selected_text_ = WideToUTF8(text); |
| 1600 OwnPrimarySelection(selected_text_); | 1604 OwnPrimarySelection(selected_text_); |
| 1601 } | 1605 } |
| 1602 } | 1606 } |
| OLD | NEW |