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

Side by Side Diff: apps/shell_window.h

Issue 55293003: Defer app window appearance until first paint. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix merge issue Created 7 years, 1 month 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
« no previous file with comments | « no previous file | apps/shell_window.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef APPS_SHELL_WINDOW_H_ 5 #ifndef APPS_SHELL_WINDOW_H_
6 #define APPS_SHELL_WINDOW_H_ 6 #define APPS_SHELL_WINDOW_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/extensions/extension_icon_image.h" 10 #include "chrome/browser/extensions/extension_icon_image.h"
11 #include "chrome/browser/extensions/extension_keybinding_registry.h" 11 #include "chrome/browser/extensions/extension_keybinding_registry.h"
12 #include "chrome/browser/sessions/session_id.h" 12 #include "chrome/browser/sessions/session_id.h"
13 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" 13 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
14 #include "content/public/browser/notification_observer.h" 14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h" 15 #include "content/public/browser/notification_registrar.h"
16 #include "content/public/browser/web_contents_delegate.h" 16 #include "content/public/browser/web_contents_delegate.h"
17 #include "content/public/browser/web_contents_observer.h"
17 #include "content/public/common/console_message_level.h" 18 #include "content/public/common/console_message_level.h"
18 #include "ui/base/ui_base_types.h" // WindowShowState 19 #include "ui/base/ui_base_types.h" // WindowShowState
19 #include "ui/gfx/image/image.h" 20 #include "ui/gfx/image/image.h"
20 #include "ui/gfx/rect.h" 21 #include "ui/gfx/rect.h"
21 22
22 class GURL; 23 class GURL;
23 class Profile; 24 class Profile;
24 class SkRegion; 25 class SkRegion;
25 26
26 namespace content { 27 namespace content {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 virtual content::WebContents* GetWebContents() const = 0; 68 virtual content::WebContents* GetWebContents() const = 0;
68 69
69 private: 70 private:
70 DISALLOW_COPY_AND_ASSIGN(ShellWindowContents); 71 DISALLOW_COPY_AND_ASSIGN(ShellWindowContents);
71 }; 72 };
72 73
73 // ShellWindow is the type of window used by platform apps. Shell windows 74 // ShellWindow is the type of window used by platform apps. Shell windows
74 // have a WebContents but none of the chrome of normal browser windows. 75 // have a WebContents but none of the chrome of normal browser windows.
75 class ShellWindow : public content::NotificationObserver, 76 class ShellWindow : public content::NotificationObserver,
76 public content::WebContentsDelegate, 77 public content::WebContentsDelegate,
78 public content::WebContentsObserver,
77 public web_modal::WebContentsModalDialogManagerDelegate, 79 public web_modal::WebContentsModalDialogManagerDelegate,
78 public extensions::ExtensionKeybindingRegistry::Delegate, 80 public extensions::ExtensionKeybindingRegistry::Delegate,
79 public extensions::IconImage::Observer { 81 public extensions::IconImage::Observer {
80 public: 82 public:
81 enum WindowType { 83 enum WindowType {
82 WINDOW_TYPE_DEFAULT = 1 << 0, // Default shell window. 84 WINDOW_TYPE_DEFAULT = 1 << 0, // Default shell window.
83 WINDOW_TYPE_PANEL = 1 << 1, // OS controlled panel window (Ash only). 85 WINDOW_TYPE_PANEL = 1 << 1, // OS controlled panel window (Ash only).
84 WINDOW_TYPE_V1_PANEL = 1 << 2, // For apps v1 support in Ash; deprecate 86 WINDOW_TYPE_V1_PANEL = 1 << 2, // For apps v1 support in Ash; deprecate
85 // with v1 apps. 87 // with v1 apps.
86 }; 88 };
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // on chrome.app.window API. 281 // on chrome.app.window API.
280 void Fullscreen(); 282 void Fullscreen();
281 void Maximize(); 283 void Maximize();
282 void Minimize(); 284 void Minimize();
283 void Restore(); 285 void Restore();
284 286
285 // Set the minimum and maximum size that this window is allowed to be. 287 // Set the minimum and maximum size that this window is allowed to be.
286 void SetMinimumSize(const gfx::Size& min_size); 288 void SetMinimumSize(const gfx::Size& min_size);
287 void SetMaximumSize(const gfx::Size& max_size); 289 void SetMaximumSize(const gfx::Size& max_size);
288 290
291 enum ShowType {
292 SHOW_ACTIVE,
293 SHOW_INACTIVE
294 };
295
296 // Shows the window if its contents have been painted; otherwise flags the
297 // window to be shown as soon as its contents are painted for the first time.
298 void Show(ShowType show_type);
299
300 // Hides the window. If the window was previously flagged to be shown on
301 // first paint, it will be unflagged.
302 void Hide();
303
289 ShellWindowContents* shell_window_contents_for_test() { 304 ShellWindowContents* shell_window_contents_for_test() {
290 return shell_window_contents_.get(); 305 return shell_window_contents_.get();
291 } 306 }
292 307
293 // Get the size constraints. 308 // Get the size constraints.
294 const SizeConstraints& size_constraints() const { 309 const SizeConstraints& size_constraints() const {
295 return size_constraints_; 310 return size_constraints_;
296 } 311 }
297 312
298 protected: 313 protected:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 const gfx::Rect& initial_pos, 348 const gfx::Rect& initial_pos,
334 bool user_gesture, 349 bool user_gesture,
335 bool* was_blocked) OVERRIDE; 350 bool* was_blocked) OVERRIDE;
336 virtual void HandleKeyboardEvent( 351 virtual void HandleKeyboardEvent(
337 content::WebContents* source, 352 content::WebContents* source,
338 const content::NativeWebKeyboardEvent& event) OVERRIDE; 353 const content::NativeWebKeyboardEvent& event) OVERRIDE;
339 virtual void RequestToLockMouse(content::WebContents* web_contents, 354 virtual void RequestToLockMouse(content::WebContents* web_contents,
340 bool user_gesture, 355 bool user_gesture,
341 bool last_unlocked_by_target) OVERRIDE; 356 bool last_unlocked_by_target) OVERRIDE;
342 357
358 // content::WebContentsObserver implementation.
359 virtual void DidFirstVisuallyNonEmptyPaint(int32 page_id) OVERRIDE;
360
343 // content::NotificationObserver implementation. 361 // content::NotificationObserver implementation.
344 virtual void Observe(int type, 362 virtual void Observe(int type,
345 const content::NotificationSource& source, 363 const content::NotificationSource& source,
346 const content::NotificationDetails& details) OVERRIDE; 364 const content::NotificationDetails& details) OVERRIDE;
347 365
348 // web_modal::WebContentsModalDialogManagerDelegate implementation. 366 // web_modal::WebContentsModalDialogManagerDelegate implementation.
349 virtual void SetWebContentsBlocked(content::WebContents* web_contents, 367 virtual void SetWebContentsBlocked(content::WebContents* web_contents,
350 bool blocked) OVERRIDE; 368 bool blocked) OVERRIDE;
351 virtual bool IsWebContentsVisible( 369 virtual bool IsWebContentsVisible(
352 content::WebContents* web_contents) OVERRIDE; 370 content::WebContents* web_contents) OVERRIDE;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 base::WeakPtrFactory<ShellWindow> image_loader_ptr_factory_; 445 base::WeakPtrFactory<ShellWindow> image_loader_ptr_factory_;
428 446
429 // Fullscreen entered by app.window api. 447 // Fullscreen entered by app.window api.
430 bool fullscreen_for_window_api_; 448 bool fullscreen_for_window_api_;
431 // Fullscreen entered by HTML requestFullscreen. 449 // Fullscreen entered by HTML requestFullscreen.
432 bool fullscreen_for_tab_; 450 bool fullscreen_for_tab_;
433 451
434 // Size constraints on the window. 452 // Size constraints on the window.
435 SizeConstraints size_constraints_; 453 SizeConstraints size_constraints_;
436 454
455 // Show has been called, so the window should be shown once the first visually
456 // non-empty paint occurs.
457 bool show_on_first_paint_;
458
459 // The first visually non-empty paint has completed.
460 bool first_paint_complete_;
461
462 // Whether the delayed Show() call was for an active or inactive window.
463 ShowType delayed_show_type_;
464
437 DISALLOW_COPY_AND_ASSIGN(ShellWindow); 465 DISALLOW_COPY_AND_ASSIGN(ShellWindow);
438 }; 466 };
439 467
440 } // namespace apps 468 } // namespace apps
441 469
442 #endif // APPS_SHELL_WINDOW_H_ 470 #endif // APPS_SHELL_WINDOW_H_
OLDNEW
« no previous file with comments | « no previous file | apps/shell_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698