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

Side by Side Diff: chrome/browser/ui/views/constrained_window_views.cc

Issue 10540100: TabContentsWrapper -> TabContents, part 48. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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/constrained_window_views.h" 5 #include "chrome/browser/ui/views/constrained_window_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/themes/theme_service.h" 12 #include "chrome/browser/themes/theme_service.h"
13 #include "chrome/browser/ui/constrained_window_tab_helper.h" 13 #include "chrome/browser/ui/constrained_window_tab_helper.h"
14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 14 #include "chrome/browser/ui/tab_contents/tab_contents.h"
15 #include "chrome/browser/ui/toolbar/toolbar_model.h" 15 #include "chrome/browser/ui/toolbar/toolbar_model.h"
16 #include "chrome/browser/ui/views/frame/browser_view.h" 16 #include "chrome/browser/ui/views/frame/browser_view.h"
17 #include "chrome/common/chrome_constants.h" 17 #include "chrome/common/chrome_constants.h"
18 #include "chrome/common/chrome_notification_types.h" 18 #include "chrome/common/chrome_notification_types.h"
19 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
20 #include "content/public/browser/web_contents_view.h" 20 #include "content/public/browser/web_contents_view.h"
21 #include "grit/chromium_strings.h" 21 #include "grit/chromium_strings.h"
22 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
23 #include "grit/theme_resources.h" 23 #include "grit/theme_resources.h"
24 #include "grit/theme_resources_standard.h" 24 #include "grit/theme_resources_standard.h"
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 private: 564 private:
565 ConstrainedWindowViews* container_; // not owned 565 ConstrainedWindowViews* container_; // not owned
566 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowFrameViewAsh); 566 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowFrameViewAsh);
567 }; 567 };
568 #endif // defined(USE_ASH) 568 #endif // defined(USE_ASH)
569 569
570 //////////////////////////////////////////////////////////////////////////////// 570 ////////////////////////////////////////////////////////////////////////////////
571 // ConstrainedWindowViews, public: 571 // ConstrainedWindowViews, public:
572 572
573 ConstrainedWindowViews::ConstrainedWindowViews( 573 ConstrainedWindowViews::ConstrainedWindowViews(
574 TabContentsWrapper* wrapper, 574 TabContents* tab_contents,
575 views::WidgetDelegate* widget_delegate) 575 views::WidgetDelegate* widget_delegate)
576 : wrapper_(wrapper), 576 : tab_contents_(tab_contents),
577 ALLOW_THIS_IN_INITIALIZER_LIST(native_constrained_window_( 577 ALLOW_THIS_IN_INITIALIZER_LIST(native_constrained_window_(
578 NativeConstrainedWindow::CreateNativeConstrainedWindow(this))) { 578 NativeConstrainedWindow::CreateNativeConstrainedWindow(this))) {
579 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); 579 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
580 params.delegate = widget_delegate; 580 params.delegate = widget_delegate;
581 params.native_widget = native_constrained_window_->AsNativeWidget(); 581 params.native_widget = native_constrained_window_->AsNativeWidget();
582 params.child = true; 582 params.child = true;
583 params.parent = wrapper->web_contents()->GetNativeView(); 583 params.parent = tab_contents->web_contents()->GetNativeView();
584 #if defined(USE_ASH) 584 #if defined(USE_ASH)
585 // Ash window headers can be transparent. 585 // Ash window headers can be transparent.
586 params.transparent = true; 586 params.transparent = true;
587 ash::SetChildWindowVisibilityChangesAnimated(params.parent); 587 ash::SetChildWindowVisibilityChangesAnimated(params.parent);
588 #endif 588 #endif
589 Init(params); 589 Init(params);
590 590
591 wrapper_->constrained_window_tab_helper()->AddConstrainedDialog(this); 591 tab_contents_->constrained_window_tab_helper()->AddConstrainedDialog(this);
592 } 592 }
593 593
594 ConstrainedWindowViews::~ConstrainedWindowViews() { 594 ConstrainedWindowViews::~ConstrainedWindowViews() {
595 } 595 }
596 596
597 //////////////////////////////////////////////////////////////////////////////// 597 ////////////////////////////////////////////////////////////////////////////////
598 // ConstrainedWindowViews, ConstrainedWindow implementation: 598 // ConstrainedWindowViews, ConstrainedWindow implementation:
599 599
600 void ConstrainedWindowViews::ShowConstrainedWindow() { 600 void ConstrainedWindowViews::ShowConstrainedWindow() {
601 ConstrainedWindowTabHelper* helper = 601 ConstrainedWindowTabHelper* helper =
602 wrapper_->constrained_window_tab_helper(); 602 tab_contents_->constrained_window_tab_helper();
603 if (helper && helper->delegate()) 603 if (helper && helper->delegate())
604 helper->delegate()->WillShowConstrainedWindow(wrapper_); 604 helper->delegate()->WillShowConstrainedWindow(tab_contents_);
605 Show(); 605 Show();
606 FocusConstrainedWindow(); 606 FocusConstrainedWindow();
607 } 607 }
608 608
609 void ConstrainedWindowViews::CloseConstrainedWindow() { 609 void ConstrainedWindowViews::CloseConstrainedWindow() {
610 wrapper_->constrained_window_tab_helper()->WillClose(this); 610 tab_contents_->constrained_window_tab_helper()->WillClose(this);
611 Close(); 611 Close();
612 } 612 }
613 613
614 void ConstrainedWindowViews::FocusConstrainedWindow() { 614 void ConstrainedWindowViews::FocusConstrainedWindow() {
615 ConstrainedWindowTabHelper* helper = 615 ConstrainedWindowTabHelper* helper =
616 wrapper_->constrained_window_tab_helper(); 616 tab_contents_->constrained_window_tab_helper();
617 if ((!helper->delegate() || 617 if ((!helper->delegate() ||
618 helper->delegate()->ShouldFocusConstrainedWindow()) && 618 helper->delegate()->ShouldFocusConstrainedWindow()) &&
619 widget_delegate() && 619 widget_delegate() &&
620 widget_delegate()->GetInitiallyFocusedView()) { 620 widget_delegate()->GetInitiallyFocusedView()) {
621 widget_delegate()->GetInitiallyFocusedView()->RequestFocus(); 621 widget_delegate()->GetInitiallyFocusedView()->RequestFocus();
622 } 622 }
623 #if defined(USE_ASH) 623 #if defined(USE_ASH)
624 GetNativeView()->Focus(); 624 GetNativeView()->Focus();
625 #endif 625 #endif
626 } 626 }
(...skipping 14 matching lines...) Expand all
641 frame->Init(this); 641 frame->Init(this);
642 return frame; 642 return frame;
643 #endif 643 #endif
644 return new ConstrainedWindowFrameView(this); 644 return new ConstrainedWindowFrameView(this);
645 } 645 }
646 646
647 //////////////////////////////////////////////////////////////////////////////// 647 ////////////////////////////////////////////////////////////////////////////////
648 // ConstrainedWindowViews, NativeConstrainedWindowDelegate implementation: 648 // ConstrainedWindowViews, NativeConstrainedWindowDelegate implementation:
649 649
650 void ConstrainedWindowViews::OnNativeConstrainedWindowDestroyed() { 650 void ConstrainedWindowViews::OnNativeConstrainedWindowDestroyed() {
651 wrapper_->constrained_window_tab_helper()->WillClose(this); 651 tab_contents_->constrained_window_tab_helper()->WillClose(this);
652 } 652 }
653 653
654 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { 654 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() {
655 Activate(); 655 Activate();
656 } 656 }
657 657
658 views::internal::NativeWidgetDelegate* 658 views::internal::NativeWidgetDelegate*
659 ConstrainedWindowViews::AsNativeWidgetDelegate() { 659 ConstrainedWindowViews::AsNativeWidgetDelegate() {
660 return this; 660 return this;
661 } 661 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/constrained_window_views.h ('k') | chrome/browser/ui/views/constrained_window_views_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698