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

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

Issue 179028: Revert "Fix a ton of compiler warnings." (Closed)
Patch Set: Created 11 years, 3 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
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_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 10
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 const GURL url(match.destination_url); 357 const GURL url(match.destination_url);
358 std::wstring keyword; 358 std::wstring keyword;
359 const bool is_keyword_hint = model_->GetKeywordForMatch(match, &keyword); 359 const bool is_keyword_hint = model_->GetKeywordForMatch(match, &keyword);
360 edit_view_->OpenURL(url, disposition, match.transition, GURL(), line, 360 edit_view_->OpenURL(url, disposition, match.transition, GURL(), line,
361 is_keyword_hint ? std::wstring() : keyword); 361 is_keyword_hint ? std::wstring() : keyword);
362 } 362 }
363 363
364 gboolean AutocompletePopupViewGtk::HandleMotion(GtkWidget* widget, 364 gboolean AutocompletePopupViewGtk::HandleMotion(GtkWidget* widget,
365 GdkEventMotion* event) { 365 GdkEventMotion* event) {
366 // TODO(deanm): Windows has a bunch of complicated logic here. 366 // TODO(deanm): Windows has a bunch of complicated logic here.
367 size_t line = LineFromY(static_cast<int>(event->y)); 367 size_t line = LineFromY(event->y);
368 // There is both a hovered and selected line, hovered just means your mouse 368 // There is both a hovered and selected line, hovered just means your mouse
369 // is over it, but selected is what's showing in the location edit. 369 // is over it, but selected is what's showing in the location edit.
370 model_->SetHoveredLine(line); 370 model_->SetHoveredLine(line);
371 // Select the line if the user has the left mouse button down. 371 // Select the line if the user has the left mouse button down.
372 if (event->state & GDK_BUTTON1_MASK) 372 if (event->state & GDK_BUTTON1_MASK)
373 model_->SetSelectedLine(line, false); 373 model_->SetSelectedLine(line, false);
374 return TRUE; 374 return TRUE;
375 } 375 }
376 376
377 gboolean AutocompletePopupViewGtk::HandleButtonPress(GtkWidget* widget, 377 gboolean AutocompletePopupViewGtk::HandleButtonPress(GtkWidget* widget,
378 GdkEventButton* event) { 378 GdkEventButton* event) {
379 // Very similar to HandleMotion. 379 // Very similar to HandleMotion.
380 size_t line = LineFromY(static_cast<int>(event->y)); 380 size_t line = LineFromY(event->y);
381 model_->SetHoveredLine(line); 381 model_->SetHoveredLine(line);
382 if (event->button == 1) 382 if (event->button == 1)
383 model_->SetSelectedLine(line, false); 383 model_->SetSelectedLine(line, false);
384 return TRUE; 384 return TRUE;
385 } 385 }
386 386
387 gboolean AutocompletePopupViewGtk::HandleButtonRelease(GtkWidget* widget, 387 gboolean AutocompletePopupViewGtk::HandleButtonRelease(GtkWidget* widget,
388 GdkEventButton* event) { 388 GdkEventButton* event) {
389 size_t line = LineFromY(static_cast<int>(event->y)); 389 size_t line = LineFromY(event->y);
390 switch (event->button) { 390 switch (event->button) {
391 case 1: // Left click. 391 case 1: // Left click.
392 AcceptLine(line, CURRENT_TAB); 392 AcceptLine(line, CURRENT_TAB);
393 break; 393 break;
394 case 2: // Middle click. 394 case 2: // Middle click.
395 AcceptLine(line, NEW_BACKGROUND_TAB); 395 AcceptLine(line, NEW_BACKGROUND_TAB);
396 break; 396 break;
397 default: 397 default:
398 // Don't open the result. 398 // Don't open the result.
399 break; 399 break;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 // Draw the icon for this result. 458 // Draw the icon for this result.
459 DrawFullPixbuf(drawable, gc, IconForMatch(match, is_selected), 459 DrawFullPixbuf(drawable, gc, IconForMatch(match, is_selected),
460 icon_start_x, line_rect.y() + kIconTopPadding); 460 icon_start_x, line_rect.y() + kIconTopPadding);
461 461
462 // Draw the results text vertically centered in the results space. 462 // Draw the results text vertically centered in the results space.
463 // First draw the contents / url, but don't let it take up the whole width 463 // First draw the contents / url, but don't let it take up the whole width
464 // if there is also a description to be shown. 464 // if there is also a description to be shown.
465 bool has_description = !match.description.empty(); 465 bool has_description = !match.description.empty();
466 int text_width = window_rect.width() - (kIconAreaWidth + kRightPadding); 466 int text_width = window_rect.width() - (kIconAreaWidth + kRightPadding);
467 int allocated_content_width = has_description ? 467 int allocated_content_width = has_description ?
468 static_cast<int>(text_width * kContentWidthPercentage) : text_width; 468 text_width * kContentWidthPercentage : text_width;
469 pango_layout_set_width(layout_, allocated_content_width * PANGO_SCALE); 469 pango_layout_set_width(layout_, allocated_content_width * PANGO_SCALE);
470 470
471 // Note: We force to URL to LTR for all text directions. 471 // Note: We force to URL to LTR for all text directions.
472 SetupLayoutForMatch(layout_, match.contents, match.contents_class, 472 SetupLayoutForMatch(layout_, match.contents, match.contents_class,
473 &kContentTextColor, std::string()); 473 &kContentTextColor, std::string());
474 474
475 int actual_content_width, actual_content_height; 475 int actual_content_width, actual_content_height;
476 pango_layout_get_size(layout_, 476 pango_layout_get_size(layout_,
477 &actual_content_width, &actual_content_height); 477 &actual_content_width, &actual_content_height);
478 actual_content_width /= PANGO_SCALE; 478 actual_content_width /= PANGO_SCALE;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 // static 512 // static
513 AutocompletePopupView* AutocompletePopupView::CreatePopupView( 513 AutocompletePopupView* AutocompletePopupView::CreatePopupView(
514 const gfx::Font& font, 514 const gfx::Font& font,
515 AutocompleteEditView* edit_view, 515 AutocompleteEditView* edit_view,
516 AutocompleteEditModel* edit_model, 516 AutocompleteEditModel* edit_model,
517 Profile* profile, 517 Profile* profile,
518 AutocompletePopupPositioner* popup_positioner) { 518 AutocompletePopupPositioner* popup_positioner) {
519 return new AutocompletePopupViewGtk(edit_view, edit_model, profile, 519 return new AutocompletePopupViewGtk(edit_view, edit_model, profile,
520 popup_positioner); 520 popup_positioner);
521 } 521 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_popup_view.h ('k') | chrome/browser/automation/automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698