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 "content/shell/shell.h" | 5 #include "content/shell/shell.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 static const int kTestWindowHeight = 600; | 34 static const int kTestWindowHeight = 600; |
35 | 35 |
36 namespace content { | 36 namespace content { |
37 | 37 |
38 std::vector<Shell*> Shell::windows_; | 38 std::vector<Shell*> Shell::windows_; |
39 base::Callback<void(Shell*)> Shell::shell_created_callback_; | 39 base::Callback<void(Shell*)> Shell::shell_created_callback_; |
40 | 40 |
41 bool Shell::quit_message_loop_ = true; | 41 bool Shell::quit_message_loop_ = true; |
42 | 42 |
43 Shell::Shell(WebContents* web_contents) | 43 Shell::Shell(WebContents* web_contents) |
44 : window_(NULL), | 44 : is_fullscreen_(false), |
| 45 window_(NULL), |
45 url_edit_view_(NULL) | 46 url_edit_view_(NULL) |
46 #if defined(OS_WIN) && !defined(USE_AURA) | 47 #if defined(OS_WIN) && !defined(USE_AURA) |
47 , default_edit_wnd_proc_(0) | 48 , default_edit_wnd_proc_(0) |
48 #endif | 49 #endif |
49 { | 50 { |
50 registrar_.Add(this, NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, | 51 registrar_.Add(this, NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, |
51 Source<WebContents>(web_contents)); | 52 Source<WebContents>(web_contents)); |
52 windows_.push_back(this); | 53 windows_.push_back(this); |
53 | 54 |
54 if (!shell_created_callback_.is_null()) { | 55 if (!shell_created_callback_.is_null()) { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 source->GetController().LoadURL( | 185 source->GetController().LoadURL( |
185 params.url, params.referrer, params.transition, std::string()); | 186 params.url, params.referrer, params.transition, std::string()); |
186 return source; | 187 return source; |
187 } | 188 } |
188 | 189 |
189 void Shell::LoadingStateChanged(WebContents* source) { | 190 void Shell::LoadingStateChanged(WebContents* source) { |
190 UpdateNavigationControls(); | 191 UpdateNavigationControls(); |
191 PlatformSetIsLoading(source->IsLoading()); | 192 PlatformSetIsLoading(source->IsLoading()); |
192 } | 193 } |
193 | 194 |
| 195 void Shell::ToggleFullscreenModeForTab(WebContents* web_contents, |
| 196 bool enter_fullscreen) { |
| 197 #if defined(OS_ANDROID) |
| 198 PlatformToggleFullscreenModeForTab(web_contents, enter_fullscreen); |
| 199 #endif |
| 200 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
| 201 return; |
| 202 if (is_fullscreen_ != enter_fullscreen) { |
| 203 is_fullscreen_ = enter_fullscreen; |
| 204 web_contents->GetRenderViewHost()->WasResized(); |
| 205 } |
| 206 } |
| 207 |
| 208 bool Shell::IsFullscreenForTabOrPending(const WebContents* web_contents) const { |
| 209 #if defined(OS_ANDROID) |
| 210 return PlatformIsFullscreenForTabOrPending(web_contents); |
| 211 #else |
| 212 return is_fullscreen_; |
| 213 #endif |
| 214 } |
| 215 |
194 void Shell::CloseContents(WebContents* source) { | 216 void Shell::CloseContents(WebContents* source) { |
195 Close(); | 217 Close(); |
196 } | 218 } |
197 | 219 |
198 bool Shell::CanOverscrollContent() const { | 220 bool Shell::CanOverscrollContent() const { |
199 #if defined(USE_AURA) | 221 #if defined(USE_AURA) |
200 return true; | 222 return true; |
201 #else | 223 #else |
202 return false; | 224 return false; |
203 #endif | 225 #endif |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 Details<std::pair<NavigationEntry*, bool> >(details).ptr(); | 272 Details<std::pair<NavigationEntry*, bool> >(details).ptr(); |
251 | 273 |
252 if (title->first) { | 274 if (title->first) { |
253 string16 text = title->first->GetTitle(); | 275 string16 text = title->first->GetTitle(); |
254 PlatformSetTitle(text); | 276 PlatformSetTitle(text); |
255 } | 277 } |
256 } | 278 } |
257 } | 279 } |
258 | 280 |
259 } // namespace content | 281 } // namespace content |
OLD | NEW |