| 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_popup_view_gtk.h" | 5 #include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 } | 373 } |
| 374 | 374 |
| 375 void AutocompletePopupViewGtk::Observe(NotificationType type, | 375 void AutocompletePopupViewGtk::Observe(NotificationType type, |
| 376 const NotificationSource& source, | 376 const NotificationSource& source, |
| 377 const NotificationDetails& details) { | 377 const NotificationDetails& details) { |
| 378 DCHECK(type == NotificationType::BROWSER_THEME_CHANGED); | 378 DCHECK(type == NotificationType::BROWSER_THEME_CHANGED); |
| 379 | 379 |
| 380 if (theme_provider_->UseGtkTheme()) { | 380 if (theme_provider_->UseGtkTheme()) { |
| 381 border_color_ = theme_provider_->GetBorderColor(); | 381 border_color_ = theme_provider_->GetBorderColor(); |
| 382 | 382 |
| 383 // Create a fake gtk table | 383 gtk_util::GetTextColors( |
| 384 GtkWidget* fake_tree = gtk_entry_new(); | 384 &background_color_, &selected_background_color_, |
| 385 GtkStyle* style = gtk_rc_get_style(fake_tree); | 385 &content_text_color_, &selected_content_text_color_); |
| 386 | 386 |
| 387 background_color_ = style->base[GTK_STATE_NORMAL]; | |
| 388 selected_background_color_ = style->base[GTK_STATE_SELECTED]; | |
| 389 hovered_background_color_ = gtk_util::AverageColors( | 387 hovered_background_color_ = gtk_util::AverageColors( |
| 390 background_color_, selected_background_color_); | 388 background_color_, selected_background_color_); |
| 391 | 389 url_text_color_ = NormalURLColor(content_text_color_); |
| 392 content_text_color_ = style->text[GTK_STATE_NORMAL]; | 390 url_selected_text_color_ = SelectedURLColor(selected_content_text_color_, |
| 393 selected_content_text_color_ = style->text[GTK_STATE_SELECTED]; | 391 selected_background_color_); |
| 394 url_text_color_ = | 392 description_text_color_ = content_text_color_; |
| 395 NormalURLColor(style->text[GTK_STATE_NORMAL]); | 393 description_selected_text_color_ = selected_content_text_color_; |
| 396 url_selected_text_color_ = | |
| 397 SelectedURLColor(style->text[GTK_STATE_SELECTED], | |
| 398 style->base[GTK_STATE_SELECTED]); | |
| 399 | |
| 400 description_text_color_ = style->text[GTK_STATE_NORMAL]; | |
| 401 description_selected_text_color_ = style->text[GTK_STATE_SELECTED]; | |
| 402 | |
| 403 g_object_ref_sink(fake_tree); | |
| 404 g_object_unref(fake_tree); | |
| 405 } else { | 394 } else { |
| 406 border_color_ = kBorderColor; | 395 border_color_ = kBorderColor; |
| 407 background_color_ = kBackgroundColor; | 396 background_color_ = kBackgroundColor; |
| 408 selected_background_color_ = kSelectedBackgroundColor; | 397 selected_background_color_ = kSelectedBackgroundColor; |
| 409 hovered_background_color_ = kHoveredBackgroundColor; | 398 hovered_background_color_ = kHoveredBackgroundColor; |
| 410 | 399 |
| 411 content_text_color_ = kContentTextColor; | 400 content_text_color_ = kContentTextColor; |
| 412 selected_content_text_color_ = kContentTextColor; | 401 selected_content_text_color_ = kContentTextColor; |
| 413 url_text_color_ = kURLTextColor; | 402 url_text_color_ = kURLTextColor; |
| 414 url_selected_text_color_ = kURLTextColor; | 403 url_selected_text_color_ = kURLTextColor; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 (text_width - actual_content_width - | 637 (text_width - actual_content_width - |
| 649 (actual_description_width / PANGO_SCALE)), | 638 (actual_description_width / PANGO_SCALE)), |
| 650 content_y, layout_); | 639 content_y, layout_); |
| 651 } | 640 } |
| 652 } | 641 } |
| 653 | 642 |
| 654 g_object_unref(gc); | 643 g_object_unref(gc); |
| 655 | 644 |
| 656 return TRUE; | 645 return TRUE; |
| 657 } | 646 } |
| OLD | NEW |