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/window.h" | 5 #include "chrome/browser/ui/views/window.h" |
6 | 6 |
7 #include "ui/views/bubble/bubble_delegate.h" | 7 #include "ui/views/bubble/bubble_delegate.h" |
8 #include "ui/views/widget/widget.h" | 8 #include "ui/views/widget/widget.h" |
9 | 9 |
10 #if defined(USE_AURA) | 10 #if defined(USE_AURA) |
11 #include "ash/ash_switches.h" | 11 #include "ash/ash_switches.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "ash/shell_window_ids.h" | 13 #include "ash/shell_window_ids.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "ui/aura/root_window.h" | 15 #include "ui/aura/root_window.h" |
16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
17 #endif | 17 #endif |
18 | 18 |
19 #if defined(OS_CHROMEOS) | 19 #if defined(OS_CHROMEOS) |
20 #include "chrome/browser/chromeos/frame/bubble_window.h" | 20 #include "chrome/browser/chromeos/frame/bubble_window.h" |
21 | |
22 #if defined(TOOLKIT_USES_GTK) | |
23 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h" | |
24 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h" | |
25 #endif // TOOLKIT_USES_GTK | |
26 | |
27 #endif // OS_CHROMEOS | 21 #endif // OS_CHROMEOS |
28 | 22 |
29 // Note: This file should be removed after the old ChromeOS frontend is removed. | 23 // Note: This file should be removed after the old ChromeOS frontend is removed. |
30 // It is not needed for Aura. | 24 // It is not needed for Aura. |
31 // The visual style implemented by BubbleFrameView/BubbleWindow for | 25 // The visual style implemented by BubbleFrameView/BubbleWindow for |
32 // ChromeOS should move to Ash. | 26 // ChromeOS should move to Ash. |
33 // Calling code should just call the standard views Widget creation | 27 // Calling code should just call the standard views Widget creation |
34 // methods and "the right thing" should just happen. | 28 // methods and "the right thing" should just happen. |
35 // The remainder of the code here is dealing with the legacy CrOS WM and | 29 // The remainder of the code here is dealing with the legacy CrOS WM and |
36 // can also be removed. | 30 // can also be removed. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 #endif | 65 #endif |
72 // No frame so does not need params.transparent = true | 66 // No frame so does not need params.transparent = true |
73 params.bounds = bounds; | 67 params.bounds = bounds; |
74 widget->Init(params); | 68 widget->Init(params); |
75 return widget; | 69 return widget; |
76 } | 70 } |
77 | 71 |
78 views::Widget* CreateViewsBubble(views::BubbleDelegateView* delegate) { | 72 views::Widget* CreateViewsBubble(views::BubbleDelegateView* delegate) { |
79 views::Widget* bubble_widget = | 73 views::Widget* bubble_widget = |
80 views::BubbleDelegateView::CreateBubble(delegate); | 74 views::BubbleDelegateView::CreateBubble(delegate); |
81 #if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK) | |
82 { | |
83 std::vector<int> params; | |
84 params.push_back(0); // Do not show when screen is locked. | |
85 chromeos::WmIpc::instance()->SetWindowType( | |
86 bubble_widget->GetNativeView(), | |
87 chromeos::WM_IPC_WINDOW_CHROME_INFO_BUBBLE, | |
88 ¶ms); | |
89 } | |
90 #endif | |
91 return bubble_widget; | 75 return bubble_widget; |
92 } | 76 } |
93 | 77 |
94 views::Widget* CreateViewsBubbleAboveLockScreen( | 78 views::Widget* CreateViewsBubbleAboveLockScreen( |
95 views::BubbleDelegateView* delegate) { | 79 views::BubbleDelegateView* delegate) { |
96 #if defined(USE_AURA) | 80 #if defined(USE_AURA) |
97 delegate->set_parent_window( | 81 delegate->set_parent_window( |
98 ash::Shell::GetInstance()->GetContainer( | 82 ash::Shell::GetInstance()->GetContainer( |
99 ash::internal::kShellWindowId_SettingBubbleContainer)); | 83 ash::internal::kShellWindowId_SettingBubbleContainer)); |
100 #endif | 84 #endif |
101 views::Widget* bubble_widget = | 85 views::Widget* bubble_widget = |
102 views::BubbleDelegateView::CreateBubble(delegate); | 86 views::BubbleDelegateView::CreateBubble(delegate); |
103 #if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK) | |
104 std::vector<int> params; | |
105 params.push_back(1); // Show while screen is locked. | |
106 chromeos::WmIpc::instance()->SetWindowType( | |
107 bubble_widget->GetNativeView(), | |
108 chromeos::WM_IPC_WINDOW_CHROME_INFO_BUBBLE, | |
109 ¶ms); | |
110 #endif | |
111 return bubble_widget; | 87 return bubble_widget; |
112 } | 88 } |
113 | 89 |
114 } // namespace browser | 90 } // namespace browser |
OLD | NEW |