Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc

Issue 214029: Adding focus to NaviteViewHost. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 if (something_changed && text_differs) 498 if (something_changed && text_differs)
499 TextChanged(); 499 TextChanged();
500 500
501 return something_changed; 501 return something_changed;
502 } 502 }
503 503
504 gfx::NativeView AutocompleteEditViewGtk::GetNativeView() const { 504 gfx::NativeView AutocompleteEditViewGtk::GetNativeView() const {
505 return alignment_.get(); 505 return alignment_.get();
506 } 506 }
507 507
508 gfx::NativeView AutocompleteEditViewGtk::GetFocusNativeView() const {
509 return text_view_;
510 }
511
508 void AutocompleteEditViewGtk::Observe(NotificationType type, 512 void AutocompleteEditViewGtk::Observe(NotificationType type,
509 const NotificationSource& source, 513 const NotificationSource& source,
510 const NotificationDetails& details) { 514 const NotificationDetails& details) {
511 DCHECK(type == NotificationType::BROWSER_THEME_CHANGED); 515 DCHECK(type == NotificationType::BROWSER_THEME_CHANGED);
512 516
513 SetBaseColor(); 517 SetBaseColor();
514 } 518 }
515 519
516 void AutocompleteEditViewGtk::SetBaseColor() { 520 void AutocompleteEditViewGtk::SetBaseColor() {
517 #if defined(TOOLKIT_VIEWS) 521 #if defined(TOOLKIT_VIEWS)
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 gtk_text_view_move_visually(GTK_TEXT_VIEW(text_view_), &start, -1); 753 gtk_text_view_move_visually(GTK_TEXT_VIEW(text_view_), &start, -1);
750 } 754 }
751 755
752 return TRUE; // Don't continue, we called the default handler already. 756 return TRUE; // Don't continue, we called the default handler already.
753 } 757 }
754 758
755 gboolean AutocompleteEditViewGtk::HandleViewFocusIn() { 759 gboolean AutocompleteEditViewGtk::HandleViewFocusIn() {
756 GdkModifierType modifiers; 760 GdkModifierType modifiers;
757 gdk_window_get_pointer(text_view_->window, NULL, NULL, &modifiers); 761 gdk_window_get_pointer(text_view_->window, NULL, NULL, &modifiers);
758 model_->OnSetFocus((modifiers & GDK_CONTROL_MASK) != 0); 762 model_->OnSetFocus((modifiers & GDK_CONTROL_MASK) != 0);
759 controller_->OnSetFocus();
760 // TODO(deanm): Some keyword hit business, etc here. 763 // TODO(deanm): Some keyword hit business, etc here.
761 764
762 return FALSE; // Continue propagation. 765 return FALSE; // Continue propagation.
763 } 766 }
764 767
765 gboolean AutocompleteEditViewGtk::HandleViewFocusOut() { 768 gboolean AutocompleteEditViewGtk::HandleViewFocusOut() {
766 // Close the popup. 769 // Close the popup.
767 ClosePopup(); 770 ClosePopup();
768 // Tell the model to reset itself. 771 // Tell the model to reset itself.
769 model_->OnKillFocus(); 772 model_->OnKillFocus();
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 std::string utf8 = WideToUTF8(text); 1180 std::string utf8 = WideToUTF8(text);
1178 gtk_text_buffer_set_text(text_buffer_, utf8.data(), utf8.length()); 1181 gtk_text_buffer_set_text(text_buffer_, utf8.data(), utf8.length());
1179 SetSelectedRange(range); 1182 SetSelectedRange(range);
1180 } 1183 }
1181 1184
1182 void AutocompleteEditViewGtk::SetSelectedRange(const CharRange& range) { 1185 void AutocompleteEditViewGtk::SetSelectedRange(const CharRange& range) {
1183 GtkTextIter insert, bound; 1186 GtkTextIter insert, bound;
1184 ItersFromCharRange(range, &bound, &insert); 1187 ItersFromCharRange(range, &bound, &insert);
1185 gtk_text_buffer_select_range(text_buffer_, &insert, &bound); 1188 gtk_text_buffer_select_range(text_buffer_, &insert, &bound);
1186 } 1189 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_gtk.h ('k') | chrome/browser/autocomplete/autocomplete_edit_view_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698