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

Side by Side Diff: chrome/browser/ui/views/panels/panel_view.cc

Issue 11669018: Support dragging panels to stack and snap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
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
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 // In order for a panel stack that holds multiple panels to appear as a single
589 // window on the taskbar or launcher, the owner window of this panel view
590 // should be set to the panel stack window. In addition, the extended style
591 // WS_EX_APPWINDOW, that is used to force a top-level window onto the taskbar,
592 // should be cleared.
593 StackedPanelCollection* stack = NULL;
594 if (panel_->collection()->type() == PanelCollection::STACKED)
595 stack = static_cast<StackedPanelCollection*>(panel_->collection());
596 HWND owner = stack ? stack->GetNativeWindow() : NULL;
597 if (owner)
598 UpdateWindowAttribute(GWL_EXSTYLE, 0, WS_EX_APPWINDOW, false);
599 else
600 UpdateWindowAttribute(GWL_EXSTYLE, WS_EX_APPWINDOW, 0, false);
601 ::SetWindowLong(GetNativePanelHandle(),
602 GWL_HWNDPARENT,
603 reinterpret_cast<LONG>(owner));
604 #else
605 NOTIMPLEMENTED();
606 #endif
607 }
608
585 void PanelView::AttachWebContents(content::WebContents* contents) { 609 void PanelView::AttachWebContents(content::WebContents* contents) {
586 web_view_->SetWebContents(contents); 610 web_view_->SetWebContents(contents);
587 } 611 }
588 612
589 void PanelView::DetachWebContents(content::WebContents* contents) { 613 void PanelView::DetachWebContents(content::WebContents* contents) {
590 web_view_->SetWebContents(NULL); 614 web_view_->SetWebContents(NULL);
591 } 615 }
592 616
593 NativePanelTesting* PanelView::CreateNativePanelTesting() { 617 NativePanelTesting* PanelView::CreateNativePanelTesting() {
594 return new NativePanelTestingWin(this); 618 return new NativePanelTestingWin(this);
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 DCHECK(thickness_for_mouse_resizing > 0); 946 DCHECK(thickness_for_mouse_resizing > 0);
923 SkRegion* region = new SkRegion; 947 SkRegion* region = new SkRegion;
924 region->op(0, 0, thickness_for_mouse_resizing, height, SkRegion::kUnion_Op); 948 region->op(0, 0, thickness_for_mouse_resizing, height, SkRegion::kUnion_Op);
925 region->op(width - thickness_for_mouse_resizing, 0, width, height, 949 region->op(width - thickness_for_mouse_resizing, 0, width, height,
926 SkRegion::kUnion_Op); 950 SkRegion::kUnion_Op);
927 region->op(0, height - thickness_for_mouse_resizing, width, height, 951 region->op(0, height - thickness_for_mouse_resizing, width, height,
928 SkRegion::kUnion_Op); 952 SkRegion::kUnion_Op);
929 web_contents->GetRenderViewHost()->GetView()->SetClickthroughRegion(region); 953 web_contents->GetRenderViewHost()->GetView()->SetClickthroughRegion(region);
930 #endif 954 #endif
931 } 955 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698