| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ | 5 #ifndef EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ |
| 6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ | 6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 } | 352 } |
| 353 | 353 |
| 354 protected: | 354 protected: |
| 355 virtual ~AppWindow(); | 355 virtual ~AppWindow(); |
| 356 | 356 |
| 357 private: | 357 private: |
| 358 // PlatformAppBrowserTest needs access to web_contents() | 358 // PlatformAppBrowserTest needs access to web_contents() |
| 359 friend class PlatformAppBrowserTest; | 359 friend class PlatformAppBrowserTest; |
| 360 | 360 |
| 361 // content::WebContentsDelegate implementation. | 361 // content::WebContentsDelegate implementation. |
| 362 virtual void CloseContents(content::WebContents* contents) OVERRIDE; | 362 virtual void CloseContents(content::WebContents* contents) override; |
| 363 virtual bool ShouldSuppressDialogs() OVERRIDE; | 363 virtual bool ShouldSuppressDialogs() override; |
| 364 virtual content::ColorChooser* OpenColorChooser( | 364 virtual content::ColorChooser* OpenColorChooser( |
| 365 content::WebContents* web_contents, | 365 content::WebContents* web_contents, |
| 366 SkColor color, | 366 SkColor color, |
| 367 const std::vector<content::ColorSuggestion>& suggestions) OVERRIDE; | 367 const std::vector<content::ColorSuggestion>& suggestions) override; |
| 368 virtual void RunFileChooser(content::WebContents* tab, | 368 virtual void RunFileChooser(content::WebContents* tab, |
| 369 const content::FileChooserParams& params) | 369 const content::FileChooserParams& params) |
| 370 OVERRIDE; | 370 override; |
| 371 virtual bool IsPopupOrPanel(const content::WebContents* source) | 371 virtual bool IsPopupOrPanel(const content::WebContents* source) |
| 372 const OVERRIDE; | 372 const override; |
| 373 virtual void MoveContents(content::WebContents* source, | 373 virtual void MoveContents(content::WebContents* source, |
| 374 const gfx::Rect& pos) OVERRIDE; | 374 const gfx::Rect& pos) override; |
| 375 virtual void NavigationStateChanged( | 375 virtual void NavigationStateChanged( |
| 376 const content::WebContents* source, | 376 const content::WebContents* source, |
| 377 content::InvalidateTypes changed_flags) OVERRIDE; | 377 content::InvalidateTypes changed_flags) override; |
| 378 virtual void ToggleFullscreenModeForTab(content::WebContents* source, | 378 virtual void ToggleFullscreenModeForTab(content::WebContents* source, |
| 379 bool enter_fullscreen) OVERRIDE; | 379 bool enter_fullscreen) override; |
| 380 virtual bool IsFullscreenForTabOrPending(const content::WebContents* source) | 380 virtual bool IsFullscreenForTabOrPending(const content::WebContents* source) |
| 381 const OVERRIDE; | 381 const override; |
| 382 virtual void RequestMediaAccessPermission( | 382 virtual void RequestMediaAccessPermission( |
| 383 content::WebContents* web_contents, | 383 content::WebContents* web_contents, |
| 384 const content::MediaStreamRequest& request, | 384 const content::MediaStreamRequest& request, |
| 385 const content::MediaResponseCallback& callback) OVERRIDE; | 385 const content::MediaResponseCallback& callback) override; |
| 386 virtual bool CheckMediaAccessPermission( | 386 virtual bool CheckMediaAccessPermission( |
| 387 content::WebContents* web_contents, | 387 content::WebContents* web_contents, |
| 388 const GURL& security_origin, | 388 const GURL& security_origin, |
| 389 content::MediaStreamType type) OVERRIDE; | 389 content::MediaStreamType type) override; |
| 390 virtual content::WebContents* OpenURLFromTab( | 390 virtual content::WebContents* OpenURLFromTab( |
| 391 content::WebContents* source, | 391 content::WebContents* source, |
| 392 const content::OpenURLParams& params) OVERRIDE; | 392 const content::OpenURLParams& params) override; |
| 393 virtual void AddNewContents(content::WebContents* source, | 393 virtual void AddNewContents(content::WebContents* source, |
| 394 content::WebContents* new_contents, | 394 content::WebContents* new_contents, |
| 395 WindowOpenDisposition disposition, | 395 WindowOpenDisposition disposition, |
| 396 const gfx::Rect& initial_pos, | 396 const gfx::Rect& initial_pos, |
| 397 bool user_gesture, | 397 bool user_gesture, |
| 398 bool* was_blocked) OVERRIDE; | 398 bool* was_blocked) override; |
| 399 virtual bool PreHandleKeyboardEvent( | 399 virtual bool PreHandleKeyboardEvent( |
| 400 content::WebContents* source, | 400 content::WebContents* source, |
| 401 const content::NativeWebKeyboardEvent& event, | 401 const content::NativeWebKeyboardEvent& event, |
| 402 bool* is_keyboard_shortcut) OVERRIDE; | 402 bool* is_keyboard_shortcut) override; |
| 403 virtual void HandleKeyboardEvent(content::WebContents* source, | 403 virtual void HandleKeyboardEvent(content::WebContents* source, |
| 404 const content::NativeWebKeyboardEvent& event) | 404 const content::NativeWebKeyboardEvent& event) |
| 405 OVERRIDE; | 405 override; |
| 406 virtual void RequestToLockMouse(content::WebContents* web_contents, | 406 virtual void RequestToLockMouse(content::WebContents* web_contents, |
| 407 bool user_gesture, | 407 bool user_gesture, |
| 408 bool last_unlocked_by_target) OVERRIDE; | 408 bool last_unlocked_by_target) override; |
| 409 virtual bool PreHandleGestureEvent(content::WebContents* source, | 409 virtual bool PreHandleGestureEvent(content::WebContents* source, |
| 410 const blink::WebGestureEvent& event) | 410 const blink::WebGestureEvent& event) |
| 411 OVERRIDE; | 411 override; |
| 412 | 412 |
| 413 // content::WebContentsObserver implementation. | 413 // content::WebContentsObserver implementation. |
| 414 virtual void DidFirstVisuallyNonEmptyPaint() OVERRIDE; | 414 virtual void DidFirstVisuallyNonEmptyPaint() override; |
| 415 | 415 |
| 416 // ExtensionRegistryObserver implementation. | 416 // ExtensionRegistryObserver implementation. |
| 417 virtual void OnExtensionUnloaded( | 417 virtual void OnExtensionUnloaded( |
| 418 content::BrowserContext* browser_context, | 418 content::BrowserContext* browser_context, |
| 419 const Extension* extension, | 419 const Extension* extension, |
| 420 UnloadedExtensionInfo::Reason reason) OVERRIDE; | 420 UnloadedExtensionInfo::Reason reason) override; |
| 421 virtual void OnExtensionWillBeInstalled( | 421 virtual void OnExtensionWillBeInstalled( |
| 422 content::BrowserContext* browser_context, | 422 content::BrowserContext* browser_context, |
| 423 const Extension* extension, | 423 const Extension* extension, |
| 424 bool is_update, | 424 bool is_update, |
| 425 bool from_ephemeral, | 425 bool from_ephemeral, |
| 426 const std::string& old_name) OVERRIDE; | 426 const std::string& old_name) override; |
| 427 | 427 |
| 428 // web_modal::WebContentsModalDialogManagerDelegate implementation. | 428 // web_modal::WebContentsModalDialogManagerDelegate implementation. |
| 429 virtual void SetWebContentsBlocked(content::WebContents* web_contents, | 429 virtual void SetWebContentsBlocked(content::WebContents* web_contents, |
| 430 bool blocked) OVERRIDE; | 430 bool blocked) override; |
| 431 virtual bool IsWebContentsVisible(content::WebContents* web_contents) | 431 virtual bool IsWebContentsVisible(content::WebContents* web_contents) |
| 432 OVERRIDE; | 432 override; |
| 433 | 433 |
| 434 // Saves the window geometry/position/screen bounds. | 434 // Saves the window geometry/position/screen bounds. |
| 435 void SaveWindowPosition(); | 435 void SaveWindowPosition(); |
| 436 | 436 |
| 437 // Helper method to adjust the cached bounds so that we can make sure it can | 437 // Helper method to adjust the cached bounds so that we can make sure it can |
| 438 // be visible on the screen. See http://crbug.com/145752. | 438 // be visible on the screen. See http://crbug.com/145752. |
| 439 void AdjustBoundsToBeVisibleOnScreen(const gfx::Rect& cached_bounds, | 439 void AdjustBoundsToBeVisibleOnScreen(const gfx::Rect& cached_bounds, |
| 440 const gfx::Rect& cached_screen_bounds, | 440 const gfx::Rect& cached_screen_bounds, |
| 441 const gfx::Rect& current_screen_bounds, | 441 const gfx::Rect& current_screen_bounds, |
| 442 const gfx::Size& minimum_size, | 442 const gfx::Size& minimum_size, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 458 | 458 |
| 459 // Update the always-on-top bit in the native app window. | 459 // Update the always-on-top bit in the native app window. |
| 460 void UpdateNativeAlwaysOnTop(); | 460 void UpdateNativeAlwaysOnTop(); |
| 461 | 461 |
| 462 // Sends the onWindowShown event to the app if the window has been shown. Only | 462 // Sends the onWindowShown event to the app if the window has been shown. Only |
| 463 // has an effect in tests. | 463 // has an effect in tests. |
| 464 void SendOnWindowShownIfShown(); | 464 void SendOnWindowShownIfShown(); |
| 465 | 465 |
| 466 // web_modal::WebContentsModalDialogManagerDelegate implementation. | 466 // web_modal::WebContentsModalDialogManagerDelegate implementation. |
| 467 virtual web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost() | 467 virtual web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost() |
| 468 OVERRIDE; | 468 override; |
| 469 | 469 |
| 470 // Updates the badge to |image|. Called internally from the image loader | 470 // Updates the badge to |image|. Called internally from the image loader |
| 471 // callback. | 471 // callback. |
| 472 void UpdateBadgeIcon(const gfx::Image& image); | 472 void UpdateBadgeIcon(const gfx::Image& image); |
| 473 | 473 |
| 474 // Callback from web_contents()->DownloadFavicon. | 474 // Callback from web_contents()->DownloadFavicon. |
| 475 void DidDownloadFavicon(int id, | 475 void DidDownloadFavicon(int id, |
| 476 int http_status_code, | 476 int http_status_code, |
| 477 const GURL& image_url, | 477 const GURL& image_url, |
| 478 const std::vector<SkBitmap>& bitmaps, | 478 const std::vector<SkBitmap>& bitmaps, |
| 479 const std::vector<gfx::Size>& original_bitmap_sizes); | 479 const std::vector<gfx::Size>& original_bitmap_sizes); |
| 480 | 480 |
| 481 // IconImage::Observer implementation. | 481 // IconImage::Observer implementation. |
| 482 virtual void OnExtensionIconImageChanged(IconImage* image) OVERRIDE; | 482 virtual void OnExtensionIconImageChanged(IconImage* image) override; |
| 483 | 483 |
| 484 // The browser context with which this window is associated. AppWindow does | 484 // The browser context with which this window is associated. AppWindow does |
| 485 // not own this object. | 485 // not own this object. |
| 486 content::BrowserContext* browser_context_; | 486 content::BrowserContext* browser_context_; |
| 487 | 487 |
| 488 const std::string extension_id_; | 488 const std::string extension_id_; |
| 489 | 489 |
| 490 // Identifier that is used when saving and restoring geometry for this | 490 // Identifier that is used when saving and restoring geometry for this |
| 491 // window. | 491 // window. |
| 492 std::string window_key_; | 492 std::string window_key_; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 | 560 |
| 561 // Whether |alpha_enabled| was set in the CreateParams. | 561 // Whether |alpha_enabled| was set in the CreateParams. |
| 562 bool requested_alpha_enabled_; | 562 bool requested_alpha_enabled_; |
| 563 | 563 |
| 564 DISALLOW_COPY_AND_ASSIGN(AppWindow); | 564 DISALLOW_COPY_AND_ASSIGN(AppWindow); |
| 565 }; | 565 }; |
| 566 | 566 |
| 567 } // namespace extensions | 567 } // namespace extensions |
| 568 | 568 |
| 569 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ | 569 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ |
| OLD | NEW |