| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #include "chrome/browser/ui/webui/chrome_web_ui.h" | 69 #include "chrome/browser/ui/webui/chrome_web_ui.h" |
| 70 #include "chrome/browser/ui/webui/feedback_ui.h" | 70 #include "chrome/browser/ui/webui/feedback_ui.h" |
| 71 #include "chrome/browser/ui/webui/task_manager_dialog.h" | 71 #include "chrome/browser/ui/webui/task_manager_dialog.h" |
| 72 #include "chrome/browser/ui/window_sizer.h" | 72 #include "chrome/browser/ui/window_sizer.h" |
| 73 #include "chrome/common/chrome_notification_types.h" | 73 #include "chrome/common/chrome_notification_types.h" |
| 74 #include "chrome/common/chrome_switches.h" | 74 #include "chrome/common/chrome_switches.h" |
| 75 #include "chrome/common/extensions/extension_resource.h" | 75 #include "chrome/common/extensions/extension_resource.h" |
| 76 #include "chrome/common/pref_names.h" | 76 #include "chrome/common/pref_names.h" |
| 77 #include "chrome/common/url_constants.h" | 77 #include "chrome/common/url_constants.h" |
| 78 #include "content/browser/renderer_host/render_view_host.h" | 78 #include "content/browser/renderer_host/render_view_host.h" |
| 79 #include "content/browser/renderer_host/render_widget_host_view.h" | |
| 80 #include "content/public/browser/download_manager.h" | 79 #include "content/public/browser/download_manager.h" |
| 81 #include "content/public/browser/notification_service.h" | 80 #include "content/public/browser/notification_service.h" |
| 82 #include "content/public/browser/user_metrics.h" | 81 #include "content/public/browser/user_metrics.h" |
| 83 #include "content/public/browser/web_contents.h" | 82 #include "content/public/browser/web_contents.h" |
| 84 #include "content/public/browser/web_contents_view.h" | 83 #include "content/public/browser/web_contents_view.h" |
| 85 #include "content/public/common/content_switches.h" | 84 #include "content/public/common/content_switches.h" |
| 86 #include "grit/chromium_strings.h" | 85 #include "grit/chromium_strings.h" |
| 87 #include "grit/generated_resources.h" | 86 #include "grit/generated_resources.h" |
| 88 #include "grit/locale_settings.h" | 87 #include "grit/locale_settings.h" |
| 89 #include "grit/theme_resources.h" | 88 #include "grit/theme_resources.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 views::Widget* widget = GetWidget(); | 286 views::Widget* widget = GetWidget(); |
| 288 return (!widget || widget->IsMaximized() || widget->IsFullscreen()) ? | 287 return (!widget || widget->IsMaximized() || widget->IsFullscreen()) ? |
| 289 gfx::Size() : GetSize(); | 288 gfx::Size() : GetSize(); |
| 290 } | 289 } |
| 291 | 290 |
| 292 virtual void Layout() { | 291 virtual void Layout() { |
| 293 if (parent()) { | 292 if (parent()) { |
| 294 gfx::Size ps = GetPreferredSize(); | 293 gfx::Size ps = GetPreferredSize(); |
| 295 // No need to handle Right to left text direction here, | 294 // No need to handle Right to left text direction here, |
| 296 // our parent must take care of it for us... | 295 // our parent must take care of it for us... |
| 297 // TODO(alekseys): fix it. | |
| 298 SetBounds(parent()->width() - ps.width(), | 296 SetBounds(parent()->width() - ps.width(), |
| 299 parent()->height() - ps.height(), ps.width(), ps.height()); | 297 parent()->height() - ps.height(), ps.width(), ps.height()); |
| 300 } | 298 } |
| 301 } | 299 } |
| 302 | 300 |
| 303 private: | 301 private: |
| 304 DISALLOW_COPY_AND_ASSIGN(ResizeCorner); | 302 DISALLOW_COPY_AND_ASSIGN(ResizeCorner); |
| 305 }; | 303 }; |
| 306 | 304 |
| 307 /////////////////////////////////////////////////////////////////////////////// | 305 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 | 1021 |
| 1024 bool BrowserView::IsTabStripEditable() const { | 1022 bool BrowserView::IsTabStripEditable() const { |
| 1025 return tabstrip_->IsTabStripEditable(); | 1023 return tabstrip_->IsTabStripEditable(); |
| 1026 } | 1024 } |
| 1027 | 1025 |
| 1028 bool BrowserView::IsToolbarVisible() const { | 1026 bool BrowserView::IsToolbarVisible() const { |
| 1029 return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) || | 1027 return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) || |
| 1030 browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR); | 1028 browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR); |
| 1031 } | 1029 } |
| 1032 | 1030 |
| 1031 gfx::Rect BrowserView::GetRootWindowResizerRect() const { |
| 1032 if (frame_->IsMaximized() || frame_->IsFullscreen()) |
| 1033 return gfx::Rect(); |
| 1034 |
| 1035 // We don't specify a resize corner size if we have a bottom shelf either. |
| 1036 // This is because we take care of drawing the resize corner on top of that |
| 1037 // shelf, so we don't want others to do it for us in this case. |
| 1038 // Currently, the only visible bottom shelf is the download shelf. |
| 1039 // Other tests should be added here if we add more bottom shelves. |
| 1040 if (IsDownloadShelfVisible()) |
| 1041 return gfx::Rect(); |
| 1042 |
| 1043 gfx::Rect client_rect = contents_split_->bounds(); |
| 1044 gfx::Size resize_corner_size = ResizeCorner::GetSize(); |
| 1045 int x = client_rect.width() - resize_corner_size.width(); |
| 1046 if (base::i18n::IsRTL()) |
| 1047 x = 0; |
| 1048 return gfx::Rect(x, client_rect.height() - resize_corner_size.height(), |
| 1049 resize_corner_size.width(), resize_corner_size.height()); |
| 1050 } |
| 1051 |
| 1033 bool BrowserView::IsPanel() const { | 1052 bool BrowserView::IsPanel() const { |
| 1034 return false; | 1053 return false; |
| 1035 } | 1054 } |
| 1036 | 1055 |
| 1037 void BrowserView::DisableInactiveFrame() { | 1056 void BrowserView::DisableInactiveFrame() { |
| 1038 #if defined(OS_WIN) && !defined(USE_AURA) | 1057 #if defined(OS_WIN) && !defined(USE_AURA) |
| 1039 frame_->DisableInactiveRendering(); | 1058 frame_->DisableInactiveRendering(); |
| 1040 #endif // No tricks are needed to get the right behavior on Linux. | 1059 #endif // No tricks are needed to get the right behavior on Linux. |
| 1041 } | 1060 } |
| 1042 | 1061 |
| (...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2548 browser::CreateViewsBubble(bubble); | 2567 browser::CreateViewsBubble(bubble); |
| 2549 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); | 2568 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
| 2550 bubble->Show(); | 2569 bubble->Show(); |
| 2551 } | 2570 } |
| 2552 | 2571 |
| 2553 void BrowserView::ShowAvatarBubbleFromAvatarButton() { | 2572 void BrowserView::ShowAvatarBubbleFromAvatarButton() { |
| 2554 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); | 2573 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); |
| 2555 if (button) | 2574 if (button) |
| 2556 button->ShowAvatarBubble(); | 2575 button->ShowAvatarBubble(); |
| 2557 } | 2576 } |
| OLD | NEW |