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

Side by Side Diff: chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc

Issue 8588068: GTK: Create the start of a compatibility header wrapping deprecated methods. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to ToT and remove views/ cleanups. Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/gtk/omnibox/omnibox_popup_view_gtk.h" 5 #include "chrome/browser/ui/gtk/omnibox/omnibox_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 10 matching lines...) Expand all
21 #include "chrome/browser/defaults.h" 21 #include "chrome/browser/defaults.h"
22 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/search_engines/template_url.h" 23 #include "chrome/browser/search_engines/template_url.h"
24 #include "chrome/browser/search_engines/template_url_service.h" 24 #include "chrome/browser/search_engines/template_url_service.h"
25 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 25 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
26 #include "chrome/browser/ui/gtk/gtk_util.h" 26 #include "chrome/browser/ui/gtk/gtk_util.h"
27 #include "chrome/browser/ui/omnibox/omnibox_view.h" 27 #include "chrome/browser/ui/omnibox/omnibox_view.h"
28 #include "chrome/common/chrome_notification_types.h" 28 #include "chrome/common/chrome_notification_types.h"
29 #include "content/public/browser/notification_source.h" 29 #include "content/public/browser/notification_source.h"
30 #include "grit/theme_resources.h" 30 #include "grit/theme_resources.h"
31 #include "ui/base/gtk/gtk_compat.h"
31 #include "ui/base/gtk/gtk_hig_constants.h" 32 #include "ui/base/gtk/gtk_hig_constants.h"
32 #include "ui/base/gtk/gtk_windowing.h" 33 #include "ui/base/gtk/gtk_windowing.h"
33 #include "ui/gfx/color_utils.h" 34 #include "ui/gfx/color_utils.h"
34 #include "ui/gfx/font.h" 35 #include "ui/gfx/font.h"
35 #include "ui/gfx/gtk_util.h" 36 #include "ui/gfx/gtk_util.h"
36 #include "ui/gfx/rect.h" 37 #include "ui/gfx/rect.h"
37 #include "ui/gfx/skia_utils_gtk.h" 38 #include "ui/gfx/skia_utils_gtk.h"
38 39
39 namespace { 40 namespace {
40 41
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 if (result.empty()) { 359 if (result.empty()) {
359 Hide(); 360 Hide();
360 return; 361 return;
361 } 362 }
362 363
363 Show(result.size()); 364 Show(result.size());
364 gtk_widget_queue_draw(window_); 365 gtk_widget_queue_draw(window_);
365 } 366 }
366 367
367 gfx::Rect OmniboxPopupViewGtk::GetTargetBounds() { 368 gfx::Rect OmniboxPopupViewGtk::GetTargetBounds() {
368 if (!GTK_WIDGET_REALIZED(window_)) 369 if (!gtk_widget_get_realized(window_))
369 return gfx::Rect(); 370 return gfx::Rect();
370 371
371 gfx::Rect retval = gtk_util::GetWidgetScreenBounds(window_); 372 gfx::Rect retval = gtk_util::GetWidgetScreenBounds(window_);
372 373
373 // The widget bounds don't update synchronously so may be out of sync with 374 // The widget bounds don't update synchronously so may be out of sync with
374 // our last size request. 375 // our last size request.
375 GtkRequisition req; 376 GtkRequisition req;
376 gtk_widget_size_request(window_, &req); 377 gtk_widget_size_request(window_, &req);
377 retval.set_width(req.width); 378 retval.set_width(req.width);
378 retval.set_height(req.height); 379 retval.set_height(req.height);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 455
455 void OmniboxPopupViewGtk::Hide() { 456 void OmniboxPopupViewGtk::Hide() {
456 gtk_widget_hide(window_); 457 gtk_widget_hide(window_);
457 opened_ = false; 458 opened_ = false;
458 } 459 }
459 460
460 void OmniboxPopupViewGtk::StackWindow() { 461 void OmniboxPopupViewGtk::StackWindow() {
461 gfx::NativeView omnibox_view = omnibox_view_->GetNativeView(); 462 gfx::NativeView omnibox_view = omnibox_view_->GetNativeView();
462 DCHECK(GTK_IS_WIDGET(omnibox_view)); 463 DCHECK(GTK_IS_WIDGET(omnibox_view));
463 GtkWidget* toplevel = gtk_widget_get_toplevel(omnibox_view); 464 GtkWidget* toplevel = gtk_widget_get_toplevel(omnibox_view);
464 DCHECK(GTK_WIDGET_TOPLEVEL(toplevel)); 465 DCHECK(gtk_widget_is_toplevel(toplevel));
465 ui::StackPopupWindow(window_, toplevel); 466 ui::StackPopupWindow(window_, toplevel);
466 } 467 }
467 468
468 size_t OmniboxPopupViewGtk::LineFromY(int y) { 469 size_t OmniboxPopupViewGtk::LineFromY(int y) {
469 size_t line = std::max(y - kBorderThickness, 0) / kHeightPerResult; 470 size_t line = std::max(y - kBorderThickness, 0) / kHeightPerResult;
470 return std::min(line, model_->result().size() - 1); 471 return std::min(line, model_->result().size() - 1);
471 } 472 }
472 473
473 void OmniboxPopupViewGtk::AcceptLine(size_t line, 474 void OmniboxPopupViewGtk::AcceptLine(size_t line,
474 WindowOpenDisposition disposition) { 475 WindowOpenDisposition disposition) {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 (text_width - actual_content_width - 682 (text_width - actual_content_width -
682 (actual_description_width / PANGO_SCALE)), 683 (actual_description_width / PANGO_SCALE)),
683 content_y, layout_); 684 content_y, layout_);
684 } 685 }
685 } 686 }
686 687
687 g_object_unref(gc); 688 g_object_unref(gc);
688 689
689 return TRUE; 690 return TRUE;
690 } 691 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/hover_controller_gtk.cc ('k') | chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698