OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "apps/app_window_contents.h" | 5 #include "apps/app_window_contents.h" |
6 | 6 |
7 #include "apps/ui/native_app_window.h" | 7 #include "apps/ui/native_app_window.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/common/extensions/api/app_window.h" | 10 #include "chrome/common/extensions/api/app_window.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 DictionaryValue* dictionary = new DictionaryValue(); | 87 DictionaryValue* dictionary = new DictionaryValue(); |
88 args.Append(dictionary); | 88 args.Append(dictionary); |
89 | 89 |
90 gfx::Rect bounds = host_->GetClientBounds(); | 90 gfx::Rect bounds = host_->GetClientBounds(); |
91 app_window::Bounds update; | 91 app_window::Bounds update; |
92 update.left.reset(new int(bounds.x())); | 92 update.left.reset(new int(bounds.x())); |
93 update.top.reset(new int(bounds.y())); | 93 update.top.reset(new int(bounds.y())); |
94 update.width.reset(new int(bounds.width())); | 94 update.width.reset(new int(bounds.width())); |
95 update.height.reset(new int(bounds.height())); | 95 update.height.reset(new int(bounds.height())); |
96 dictionary->Set("bounds", update.ToValue().release()); | 96 dictionary->Set("bounds", update.ToValue().release()); |
97 dictionary->SetBoolean("fullscreen", | 97 dictionary->SetBoolean("alwaysOnTop", native_app_window->IsAlwaysOnTop()); |
98 native_app_window->IsFullscreenOrPending()); | |
99 dictionary->SetBoolean("minimized", native_app_window->IsMinimized()); | 98 dictionary->SetBoolean("minimized", native_app_window->IsMinimized()); |
100 dictionary->SetBoolean("maximized", native_app_window->IsMaximized()); | 99 |
101 dictionary->SetBoolean("alwaysOnTop", native_app_window->IsAlwaysOnTop()); | 100 bool maximized = native_app_window->IsMaximized(); |
101 ShellWindow::FullscreenType fullscreen_type = host_->fullscreen_type(); | |
102 // Check both the fullscreen type and |native_app_window| so that the window | |
103 // is reported as fullscreen if |native_app_window|'s fullscreen state lags | |
104 // behind that of ShellWindow. (This is the case in the GTK port). | |
105 bool fullscreen = (fullscreen_type != ShellWindow::FULLSCREEN_TYPE_NONE) || | |
106 native_app_window->IsFullscreen(); | |
107 if (fullscreen_type == ShellWindow::FULLSCREEN_TYPE_IMMERSIVE) { | |
108 // A window in immersive fullscreen on ChromeOS does not take up all of the | |
109 // pixels on screen because the shelf is auto hidden, not completely hidden. | |
110 // For this reason, immersive fullscreen windows are considered maximized | |
111 // for the sake of the app.window api. | |
pkotwicz
2013/11/13 00:10:13
I am not sure whether telling the app that we are
benwells
2013/11/13 07:41:27
I think it is probably full screen enough to say i
pkotwicz
2013/11/13 22:06:01
IsFullscreenOrPending() is back. I removed it in t
| |
112 fullscreen = false; | |
113 maximized = true; | |
114 } | |
115 dictionary->SetBoolean("fullscreen", fullscreen); | |
116 dictionary->SetBoolean("maximized", maximized); | |
102 | 117 |
103 const ShellWindow::SizeConstraints& size_constraints = | 118 const ShellWindow::SizeConstraints& size_constraints = |
104 host_->size_constraints(); | 119 host_->size_constraints(); |
105 gfx::Size min_size = size_constraints.GetMinimumSize(); | 120 gfx::Size min_size = size_constraints.GetMinimumSize(); |
106 gfx::Size max_size = size_constraints.GetMaximumSize(); | 121 gfx::Size max_size = size_constraints.GetMaximumSize(); |
107 if (min_size.width() != kUnboundedSize) | 122 if (min_size.width() != kUnboundedSize) |
108 dictionary->SetInteger("minWidth", min_size.width()); | 123 dictionary->SetInteger("minWidth", min_size.width()); |
109 if (min_size.height() != kUnboundedSize) | 124 if (min_size.height() != kUnboundedSize) |
110 dictionary->SetInteger("minHeight", min_size.height()); | 125 dictionary->SetInteger("minHeight", min_size.height()); |
111 if (max_size.width() != kUnboundedSize) | 126 if (max_size.width() != kUnboundedSize) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 content::RenderViewHost* rvh) { | 202 content::RenderViewHost* rvh) { |
188 DCHECK(rvh); | 203 DCHECK(rvh); |
189 content::BrowserThread::PostTask( | 204 content::BrowserThread::PostTask( |
190 content::BrowserThread::IO, FROM_HERE, | 205 content::BrowserThread::IO, FROM_HERE, |
191 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute, | 206 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute, |
192 base::Unretained(content::ResourceDispatcherHost::Get()), | 207 base::Unretained(content::ResourceDispatcherHost::Get()), |
193 rvh->GetProcess()->GetID(), rvh->GetRoutingID())); | 208 rvh->GetProcess()->GetID(), rvh->GetRoutingID())); |
194 } | 209 } |
195 | 210 |
196 } // namespace apps | 211 } // namespace apps |
OLD | NEW |