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/gtk/bookmark_bar_gtk.h" | 5 #include "chrome/browser/gtk/bookmark_bar_gtk.h" |
6 | 6 |
7 #include "app/gfx/gtk_util.h" | 7 #include "app/gfx/gtk_util.h" |
8 #include "app/gfx/text_elider.h" | 8 #include "app/gfx/text_elider.h" |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 nodes.push_back(parent); | 457 nodes.push_back(parent); |
458 } else if (sender != bookmark_toolbar_.get()) { | 458 } else if (sender != bookmark_toolbar_.get()) { |
459 nodes.push_back(node); | 459 nodes.push_back(node); |
460 parent = node->GetParent(); | 460 parent = node->GetParent(); |
461 } else { | 461 } else { |
462 parent = model_->GetBookmarkBarNode(); | 462 parent = model_->GetBookmarkBarNode(); |
463 nodes.push_back(parent); | 463 nodes.push_back(parent); |
464 } | 464 } |
465 | 465 |
466 current_context_menu_.reset(new BookmarkContextMenu( | 466 current_context_menu_.reset(new BookmarkContextMenu( |
467 GTK_WINDOW(gtk_widget_get_toplevel(sender)), | 467 sender, profile_, browser_, page_navigator_, |
468 profile_, browser_, page_navigator_, | |
469 parent, nodes, | 468 parent, nodes, |
470 BookmarkContextMenu::BOOKMARK_BAR)); | 469 BookmarkContextMenu::BOOKMARK_BAR)); |
471 current_context_menu_->PopupAsContext(event->time); | 470 current_context_menu_->PopupAsContext(event->time); |
472 } | 471 } |
473 | 472 |
474 // static | 473 // static |
475 gboolean BookmarkBarGtk::OnButtonPressed(GtkWidget* sender, | 474 gboolean BookmarkBarGtk::OnButtonPressed(GtkWidget* sender, |
476 GdkEventButton* event, | 475 GdkEventButton* event, |
477 BookmarkBarGtk* bar) { | 476 BookmarkBarGtk* bar) { |
478 if (sender != bar->other_bookmarks_button_ && | 477 if (sender != bar->other_bookmarks_button_ && |
(...skipping 24 matching lines...) Expand all Loading... |
503 DCHECK(node); | 502 DCHECK(node); |
504 DCHECK(bar->page_navigator_); | 503 DCHECK(bar->page_navigator_); |
505 | 504 |
506 if (node->is_url()) { | 505 if (node->is_url()) { |
507 bar->page_navigator_->OpenURL( | 506 bar->page_navigator_->OpenURL( |
508 node->GetURL(), GURL(), | 507 node->GetURL(), GURL(), |
509 event_utils::DispositionFromEventFlags(event->state), | 508 event_utils::DispositionFromEventFlags(event->state), |
510 PageTransition::AUTO_BOOKMARK); | 509 PageTransition::AUTO_BOOKMARK); |
511 } else { | 510 } else { |
512 bookmark_utils::OpenAll( | 511 bookmark_utils::OpenAll( |
513 GTK_WINDOW(gtk_widget_get_toplevel(sender)), bar->profile_, | 512 sender, bar->profile_, bar->page_navigator_, node, |
514 bar->page_navigator_, node, | |
515 event_utils::DispositionFromEventFlags(event->state)); | 513 event_utils::DispositionFromEventFlags(event->state)); |
516 } | 514 } |
517 | 515 |
518 UserMetrics::RecordAction(L"ClickedBookmarkBarURLButton", bar->profile_); | 516 UserMetrics::RecordAction(L"ClickedBookmarkBarURLButton", bar->profile_); |
519 | 517 |
520 // Allow other handlers to run so the button state is updated correctly. | 518 // Allow other handlers to run so the button state is updated correctly. |
521 return FALSE; | 519 return FALSE; |
522 } | 520 } |
523 | 521 |
524 // static | 522 // static |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 cairo_rectangle(cr, event->area.x, event->area.y, | 754 cairo_rectangle(cr, event->area.x, event->area.y, |
757 event->area.width, event->area.height); | 755 event->area.width, event->area.height); |
758 cairo_clip(cr); | 756 cairo_clip(cr); |
759 bar->InitBackground(); | 757 bar->InitBackground(); |
760 bar->background_ninebox_->RenderTopCenterStrip(cr, event->area.x, | 758 bar->background_ninebox_->RenderTopCenterStrip(cr, event->area.x, |
761 0, event->area.width); | 759 0, event->area.width); |
762 cairo_destroy(cr); | 760 cairo_destroy(cr); |
763 | 761 |
764 return FALSE; // Propagate expose to children. | 762 return FALSE; // Propagate expose to children. |
765 } | 763 } |
OLD | NEW |