Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/browser_titlebar.h" | 5 #include "chrome/browser/ui/gtk/browser_titlebar.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 #include "chrome/browser/ui/gtk/accelerators_gtk.h" | 22 #include "chrome/browser/ui/gtk/accelerators_gtk.h" |
| 23 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 23 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 24 #include "chrome/browser/ui/gtk/custom_button.h" | 24 #include "chrome/browser/ui/gtk/custom_button.h" |
| 25 #if defined(USE_GCONF) | 25 #if defined(USE_GCONF) |
| 26 #include "chrome/browser/ui/gtk/gconf_titlebar_listener.h" | 26 #include "chrome/browser/ui/gtk/gconf_titlebar_listener.h" |
| 27 #endif | 27 #endif |
| 28 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 28 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 29 #include "chrome/browser/ui/gtk/gtk_util.h" | 29 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 30 #include "chrome/browser/ui/gtk/menu_gtk.h" | 30 #include "chrome/browser/ui/gtk/menu_gtk.h" |
| 31 #include "chrome/browser/ui/gtk/nine_box.h" | 31 #include "chrome/browser/ui/gtk/nine_box.h" |
| 32 #include "chrome/browser/ui/gtk/unity_service.h" | |
|
Evan Martin
2011/04/26 21:33:04
u comes after t
| |
| 32 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" | 33 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" |
| 33 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" | 34 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" |
| 34 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" | 35 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
| 35 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
| 36 #include "content/browser/tab_contents/tab_contents.h" | 37 #include "content/browser/tab_contents/tab_contents.h" |
| 37 #include "content/common/notification_service.h" | 38 #include "content/common/notification_service.h" |
| 38 #include "grit/app_resources.h" | 39 #include "grit/app_resources.h" |
| 39 #include "grit/generated_resources.h" | 40 #include "grit/generated_resources.h" |
| 40 #include "grit/theme_resources.h" | 41 #include "grit/theme_resources.h" |
| 41 #include "grit/theme_resources_standard.h" | 42 #include "grit/theme_resources_standard.h" |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 516 G_CALLBACK(OnMouseMoveEvent), browser_window_); | 517 G_CALLBACK(OnMouseMoveEvent), browser_window_); |
| 517 std::string localized_tooltip = l10n_util::GetStringUTF8(tooltip); | 518 std::string localized_tooltip = l10n_util::GetStringUTF8(tooltip); |
| 518 gtk_widget_set_tooltip_text(button->widget(), | 519 gtk_widget_set_tooltip_text(button->widget(), |
| 519 localized_tooltip.c_str()); | 520 localized_tooltip.c_str()); |
| 520 gtk_box_pack_start(GTK_BOX(box), button->widget(), FALSE, FALSE, 0); | 521 gtk_box_pack_start(GTK_BOX(box), button->widget(), FALSE, FALSE, 0); |
| 521 return button; | 522 return button; |
| 522 } | 523 } |
| 523 | 524 |
| 524 void BrowserTitlebar::UpdateCustomFrame(bool use_custom_frame) { | 525 void BrowserTitlebar::UpdateCustomFrame(bool use_custom_frame) { |
| 525 using_custom_frame_ = use_custom_frame; | 526 using_custom_frame_ = use_custom_frame; |
| 526 if (use_custom_frame) { | 527 if (!use_custom_frame || |
| 528 (browser_window_->IsMaximized() && unity::IsRunning())) { | |
| 529 if (titlebar_left_buttons_vbox_) | |
| 530 gtk_widget_hide(titlebar_left_buttons_vbox_); | |
| 531 if (titlebar_right_buttons_vbox_) | |
| 532 gtk_widget_hide(titlebar_right_buttons_vbox_); | |
| 533 } else { | |
| 527 if (titlebar_left_buttons_vbox_) | 534 if (titlebar_left_buttons_vbox_) |
| 528 gtk_widget_show_all(titlebar_left_buttons_vbox_); | 535 gtk_widget_show_all(titlebar_left_buttons_vbox_); |
| 529 if (titlebar_right_buttons_vbox_) | 536 if (titlebar_right_buttons_vbox_) |
| 530 gtk_widget_show_all(titlebar_right_buttons_vbox_); | 537 gtk_widget_show_all(titlebar_right_buttons_vbox_); |
| 531 } else { | |
| 532 if (titlebar_left_buttons_vbox_) | |
| 533 gtk_widget_hide(titlebar_left_buttons_vbox_); | |
| 534 if (titlebar_right_buttons_vbox_) | |
| 535 gtk_widget_hide(titlebar_right_buttons_vbox_); | |
| 536 } | 538 } |
| 537 UpdateTitlebarAlignment(); | 539 UpdateTitlebarAlignment(); |
| 538 UpdateMaximizeRestoreVisibility(); | 540 UpdateMaximizeRestoreVisibility(); |
| 539 } | 541 } |
| 540 | 542 |
| 541 void BrowserTitlebar::UpdateTitleAndIcon() { | 543 void BrowserTitlebar::UpdateTitleAndIcon() { |
| 542 if (!app_mode_title_) | 544 if (!app_mode_title_) |
| 543 return; | 545 return; |
| 544 | 546 |
| 545 // Get the page title and elide it to the available space. | 547 // Get the page title and elide it to the available space. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 600 if (browser_window_->browser()->type() == Browser::TYPE_NORMAL) { | 602 if (browser_window_->browser()->type() == Browser::TYPE_NORMAL) { |
| 601 int top_padding = 0; | 603 int top_padding = 0; |
| 602 int side_padding = 0; | 604 int side_padding = 0; |
| 603 int vertical_offset = kNormalVerticalOffset; | 605 int vertical_offset = kNormalVerticalOffset; |
| 604 | 606 |
| 605 if (using_custom_frame_) { | 607 if (using_custom_frame_) { |
| 606 if (!browser_window_->IsMaximized()) { | 608 if (!browser_window_->IsMaximized()) { |
| 607 top_padding = kTitlebarHeight; | 609 top_padding = kTitlebarHeight; |
| 608 } else if (using_custom_frame_ && browser_window_->IsMaximized()) { | 610 } else if (using_custom_frame_ && browser_window_->IsMaximized()) { |
| 609 vertical_offset = 0; | 611 vertical_offset = 0; |
| 610 side_padding = kMaximizedTabstripPadding; | 612 if (!unity::IsRunning()) |
| 613 side_padding = kMaximizedTabstripPadding; | |
| 611 } | 614 } |
| 612 } | 615 } |
| 613 | 616 |
| 614 int right_padding = 0; | 617 int right_padding = 0; |
| 615 int left_padding = kTabStripLeftPadding; | 618 int left_padding = kTabStripLeftPadding; |
| 616 if (titlebar_right_buttons_hbox_) | 619 if (titlebar_right_buttons_hbox_) |
| 617 right_padding = side_padding; | 620 right_padding = side_padding; |
| 618 if (titlebar_left_buttons_hbox_) | 621 if (titlebar_left_buttons_hbox_) |
| 619 left_padding = side_padding; | 622 left_padding = side_padding; |
| 620 | 623 |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 942 ui::SimpleMenuModel::Delegate* delegate) | 945 ui::SimpleMenuModel::Delegate* delegate) |
| 943 : SimpleMenuModel(delegate) { | 946 : SimpleMenuModel(delegate) { |
| 944 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); | 947 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); |
| 945 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); | 948 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); |
| 946 AddSeparator(); | 949 AddSeparator(); |
| 947 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); | 950 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); |
| 948 AddSeparator(); | 951 AddSeparator(); |
| 949 AddCheckItemWithStringId(kShowWindowDecorationsCommand, | 952 AddCheckItemWithStringId(kShowWindowDecorationsCommand, |
| 950 IDS_SHOW_WINDOW_DECORATIONS_MENU); | 953 IDS_SHOW_WINDOW_DECORATIONS_MENU); |
| 951 } | 954 } |
| OLD | NEW |