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/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/command_line.h" | 9 #include "base/command_line.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/platform_util.h" | 12 #include "chrome/browser/platform_util.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/themes/theme_service.h" | 14 #include "chrome/browser/themes/theme_service.h" |
15 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
16 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 16 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
17 #include "chrome/browser/ui/tab_contents/tab_contents.h" | |
18 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 17 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
19 #include "chrome/browser/ui/views/constrained_window_frame_simple.h" | 18 #include "chrome/browser/ui/views/constrained_window_frame_simple.h" |
20 #include "chrome/browser/ui/views/frame/browser_view.h" | 19 #include "chrome/browser/ui/views/frame/browser_view.h" |
21 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
22 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
23 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
24 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
25 #include "content/public/browser/web_contents_view.h" | 24 #include "content/public/browser/web_contents_view.h" |
26 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
27 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 bool enable_chrome_style) | 583 bool enable_chrome_style) |
585 : WebContentsObserver(web_contents), | 584 : WebContentsObserver(web_contents), |
586 web_contents_(web_contents), | 585 web_contents_(web_contents), |
587 ALLOW_THIS_IN_INITIALIZER_LIST(native_constrained_window_( | 586 ALLOW_THIS_IN_INITIALIZER_LIST(native_constrained_window_( |
588 NativeConstrainedWindow::CreateNativeConstrainedWindow(this))), | 587 NativeConstrainedWindow::CreateNativeConstrainedWindow(this))), |
589 enable_chrome_style_(enable_chrome_style) { | 588 enable_chrome_style_(enable_chrome_style) { |
590 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 589 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
591 params.delegate = widget_delegate; | 590 params.delegate = widget_delegate; |
592 params.native_widget = native_constrained_window_->AsNativeWidget(); | 591 params.native_widget = native_constrained_window_->AsNativeWidget(); |
593 params.child = true; | 592 params.child = true; |
| 593 ConstrainedWindowTabHelper::CreateForWebContents(web_contents); |
594 | 594 |
595 if (enable_chrome_style_) { | 595 if (enable_chrome_style_) { |
596 params.parent_widget = Widget::GetTopLevelWidgetForNativeView( | 596 params.parent_widget = Widget::GetTopLevelWidgetForNativeView( |
597 web_contents->GetView()->GetNativeView()); | 597 web_contents->GetView()->GetNativeView()); |
598 } else { | 598 } else { |
599 params.parent = web_contents->GetNativeView(); | 599 params.parent = web_contents->GetNativeView(); |
600 } | 600 } |
601 | 601 |
602 #if defined(USE_ASH) | 602 #if defined(USE_ASH) |
603 // Ash window headers can be transparent. | 603 // Ash window headers can be transparent. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 } | 747 } |
748 } | 748 } |
749 | 749 |
750 //////////////////////////////////////////////////////////////////////////////// | 750 //////////////////////////////////////////////////////////////////////////////// |
751 // ConstrainedWindowViews, content::WebContentsObserver implementation: | 751 // ConstrainedWindowViews, content::WebContentsObserver implementation: |
752 | 752 |
753 void ConstrainedWindowViews::WebContentsDestroyed( | 753 void ConstrainedWindowViews::WebContentsDestroyed( |
754 content::WebContents* web_contents) { | 754 content::WebContents* web_contents) { |
755 web_contents_ = NULL; | 755 web_contents_ = NULL; |
756 } | 756 } |
OLD | NEW |