OLD | NEW |
---|---|
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 "base/gfx/gtk_util.h" | 10 #include "base/gfx/gtk_util.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 13 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
14 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 14 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
15 #include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h" | 15 #include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h" |
16 #include "chrome/browser/tab_contents/tab_contents.h" | 16 #include "chrome/browser/tab_contents/tab_contents.h" |
17 #include "chrome/browser/toolbar_model.h" | 17 #include "chrome/browser/toolbar_model.h" |
18 #include "chrome/common/notification_service.h" | 18 #include "chrome/common/notification_service.h" |
19 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 const char kTextBaseColor[] = "#808080"; | 23 const char kTextBaseColor[] = "#808080"; |
24 const char kSecureSchemeColor[] = "#009614"; | 24 const char kSecureSchemeColor[] = "#009614"; |
25 const char kInsecureSchemeColor[] = "#c80000"; | 25 const char kInsecureSchemeColor[] = "#c80000"; |
26 | 26 |
27 const GdkColor kBackgroundColorByLevel[] = { | 27 const GdkColor kBackgroundColorByLevel[] = { |
28 GDK_COLOR_RGB(255, 245, 195), // SecurityLevel SECURE: Yellow. | 28 GDK_COLOR_RGB(255, 245, 195), // SecurityLevel SECURE. (yellow) |
29 GDK_COLOR_RGB(255, 255, 255), // SecurityLevel NORMAL: White. | 29 gfx::kGdkWhite, // SecurityLevel NORMAL. |
30 GDK_COLOR_RGB(255, 255, 255), // SecurityLevel INSECURE: White. | 30 gfx::kGdkWhite, // SecurityLevel INSECURE. |
Dean McNamee
2009/03/26 12:33:43
Also, this code matched windows, and is part of Lo
| |
31 }; | 31 }; |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 AutocompleteEditViewGtk::AutocompleteEditViewGtk( | 35 AutocompleteEditViewGtk::AutocompleteEditViewGtk( |
36 AutocompleteEditController* controller, | 36 AutocompleteEditController* controller, |
37 ToolbarModel* toolbar_model, | 37 ToolbarModel* toolbar_model, |
38 Profile* profile, | 38 Profile* profile, |
39 CommandUpdater* command_updater) | 39 CommandUpdater* command_updater) |
40 : tag_table_(NULL), | 40 : tag_table_(NULL), |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
432 GtkTextIter start, end; | 432 GtkTextIter start, end; |
433 gtk_text_buffer_get_bounds(text_buffer_, &start, &end); | 433 gtk_text_buffer_get_bounds(text_buffer_, &start, &end); |
434 gtk_text_view_move_visually(GTK_TEXT_VIEW(text_view_.get()), &start, -1); | 434 gtk_text_view_move_visually(GTK_TEXT_VIEW(text_view_.get()), &start, -1); |
435 | 435 |
436 return TRUE; // Don't continue, we called the default handler already. | 436 return TRUE; // Don't continue, we called the default handler already. |
437 } | 437 } |
438 | 438 |
439 gboolean AutocompleteEditViewGtk::HandleViewFocusIn() { | 439 gboolean AutocompleteEditViewGtk::HandleViewFocusIn() { |
440 model_->OnSetFocus(false); | 440 model_->OnSetFocus(false); |
441 // TODO(deanm): Some keyword hit business, etc here. | 441 // TODO(deanm): Some keyword hit business, etc here. |
442 | 442 |
443 return FALSE; // Continue propagation. | 443 return FALSE; // Continue propagation. |
444 } | 444 } |
445 | 445 |
446 gboolean AutocompleteEditViewGtk::HandleViewFocusOut() { | 446 gboolean AutocompleteEditViewGtk::HandleViewFocusOut() { |
447 // Close the popup. | 447 // Close the popup. |
448 ClosePopup(); | 448 ClosePopup(); |
449 // Tell the model to reset itself. | 449 // Tell the model to reset itself. |
450 model_->OnKillFocus(); | 450 model_->OnKillFocus(); |
451 return FALSE; // Pass the event on to the GtkTextView. | 451 return FALSE; // Pass the event on to the GtkTextView. |
452 } | 452 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
537 gtk_text_buffer_apply_tag(text_buffer_, insecure_scheme_tag_, | 537 gtk_text_buffer_apply_tag(text_buffer_, insecure_scheme_tag_, |
538 &start, &end); | 538 &start, &end); |
539 } | 539 } |
540 } | 540 } |
541 } | 541 } |
542 | 542 |
543 void AutocompleteEditViewGtk::TextChanged() { | 543 void AutocompleteEditViewGtk::TextChanged() { |
544 EmphasizeURLComponents(); | 544 EmphasizeURLComponents(); |
545 controller_->OnChanged(); | 545 controller_->OnChanged(); |
546 } | 546 } |
OLD | NEW |