Chromium Code Reviews| 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/panels/panel_view.h" | 5 #include "chrome/browser/ui/views/panels/panel_view.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/panels/panel.h" | 13 #include "chrome/browser/ui/panels/panel.h" |
| 14 #include "chrome/browser/ui/panels/panel_bounds_animation.h" | 14 #include "chrome/browser/ui/panels/panel_bounds_animation.h" |
| 15 #include "chrome/browser/ui/panels/panel_manager.h" | 15 #include "chrome/browser/ui/panels/panel_manager.h" |
| 16 #include "chrome/browser/ui/panels/stacked_panel_collection.h" | |
| 16 #include "chrome/browser/ui/views/panels/panel_frame_view.h" | 17 #include "chrome/browser/ui/views/panels/panel_frame_view.h" |
| 17 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
| 18 #include "content/public/browser/render_widget_host_view.h" | 19 #include "content/public/browser/render_widget_host_view.h" |
| 19 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 20 #include "content/public/browser/web_contents_view.h" | 21 #include "content/public/browser/web_contents_view.h" |
| 21 #include "ui/gfx/image/image.h" | 22 #include "ui/gfx/image/image.h" |
| 22 #include "ui/gfx/path.h" | 23 #include "ui/gfx/path.h" |
| 23 #include "ui/gfx/screen.h" | 24 #include "ui/gfx/screen.h" |
| 24 #include "ui/views/controls/button/image_button.h" | 25 #include "ui/views/controls/button/image_button.h" |
| 25 #include "ui/views/controls/webview/webview.h" | 26 #include "ui/views/controls/webview/webview.h" |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 const gfx::Size& window_size) const { | 576 const gfx::Size& window_size) const { |
| 576 gfx::Size frame = GetFrameView()->NonClientAreaSize(); | 577 gfx::Size frame = GetFrameView()->NonClientAreaSize(); |
| 577 return gfx::Size(window_size.width() - frame.width(), | 578 return gfx::Size(window_size.width() - frame.width(), |
| 578 window_size.height() - frame.height()); | 579 window_size.height() - frame.height()); |
| 579 } | 580 } |
| 580 | 581 |
| 581 int PanelView::TitleOnlyHeight() const { | 582 int PanelView::TitleOnlyHeight() const { |
| 582 return panel::kTitlebarHeight; | 583 return panel::kTitlebarHeight; |
| 583 } | 584 } |
| 584 | 585 |
| 586 void PanelView::UpdatePanelStackingProperty() { | |
| 587 #if defined(OS_WIN) && !defined(USE_AURA) | |
| 588 StackedPanelCollection* stack = NULL; | |
| 589 if (panel_->collection()->type() == PanelCollection::STACKED) | |
| 590 stack = static_cast<StackedPanelCollection*>(panel_->collection()); | |
| 591 HWND owner = stack ? stack->GetNativeWindow() : NULL; | |
| 592 if (owner) | |
| 593 UpdateWindowAttribute(GWL_EXSTYLE, 0, WS_EX_APPWINDOW, false); | |
|
Dmitry Titov
2013/01/09 02:29:50
Please add a comment here, to explain why this is
jianli
2013/01/09 21:00:59
Done.
| |
| 594 else | |
| 595 UpdateWindowAttribute(GWL_EXSTYLE, WS_EX_APPWINDOW, 0, false); | |
| 596 ::SetWindowLong(GetNativePanelHandle(), | |
| 597 GWL_HWNDPARENT, | |
| 598 reinterpret_cast<LONG>(owner)); | |
| 599 #else | |
| 600 NOTIMPLEMENTED(); | |
| 601 #endif | |
| 602 } | |
| 603 | |
| 585 void PanelView::AttachWebContents(content::WebContents* contents) { | 604 void PanelView::AttachWebContents(content::WebContents* contents) { |
| 586 web_view_->SetWebContents(contents); | 605 web_view_->SetWebContents(contents); |
| 587 } | 606 } |
| 588 | 607 |
| 589 void PanelView::DetachWebContents(content::WebContents* contents) { | 608 void PanelView::DetachWebContents(content::WebContents* contents) { |
| 590 web_view_->SetWebContents(NULL); | 609 web_view_->SetWebContents(NULL); |
| 591 } | 610 } |
| 592 | 611 |
| 593 NativePanelTesting* PanelView::CreateNativePanelTesting() { | 612 NativePanelTesting* PanelView::CreateNativePanelTesting() { |
| 594 return new NativePanelTestingWin(this); | 613 return new NativePanelTestingWin(this); |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 922 DCHECK(thickness_for_mouse_resizing > 0); | 941 DCHECK(thickness_for_mouse_resizing > 0); |
| 923 SkRegion* region = new SkRegion; | 942 SkRegion* region = new SkRegion; |
| 924 region->op(0, 0, thickness_for_mouse_resizing, height, SkRegion::kUnion_Op); | 943 region->op(0, 0, thickness_for_mouse_resizing, height, SkRegion::kUnion_Op); |
| 925 region->op(width - thickness_for_mouse_resizing, 0, width, height, | 944 region->op(width - thickness_for_mouse_resizing, 0, width, height, |
| 926 SkRegion::kUnion_Op); | 945 SkRegion::kUnion_Op); |
| 927 region->op(0, height - thickness_for_mouse_resizing, width, height, | 946 region->op(0, height - thickness_for_mouse_resizing, width, height, |
| 928 SkRegion::kUnion_Op); | 947 SkRegion::kUnion_Op); |
| 929 web_contents->GetRenderViewHost()->GetView()->SetClickthroughRegion(region); | 948 web_contents->GetRenderViewHost()->GetView()->SetClickthroughRegion(region); |
| 930 #endif | 949 #endif |
| 931 } | 950 } |
| OLD | NEW |