| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 void WindowEventsReady(); | 345 void WindowEventsReady(); |
| 346 | 346 |
| 347 // Whether the app window wants to be alpha enabled. | 347 // Whether the app window wants to be alpha enabled. |
| 348 bool requested_alpha_enabled() const { return requested_alpha_enabled_; } | 348 bool requested_alpha_enabled() const { return requested_alpha_enabled_; } |
| 349 | 349 |
| 350 void SetAppWindowContentsForTesting(scoped_ptr<AppWindowContents> contents) { | 350 void SetAppWindowContentsForTesting(scoped_ptr<AppWindowContents> contents) { |
| 351 app_window_contents_ = contents.Pass(); | 351 app_window_contents_ = contents.Pass(); |
| 352 } | 352 } |
| 353 | 353 |
| 354 protected: | 354 protected: |
| 355 virtual ~AppWindow(); | 355 ~AppWindow() override; |
| 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 void CloseContents(content::WebContents* contents) override; |
| 363 virtual bool ShouldSuppressDialogs() override; | 363 bool ShouldSuppressDialogs() override; |
| 364 virtual content::ColorChooser* OpenColorChooser( | 364 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 void RunFileChooser(content::WebContents* tab, |
| 369 const content::FileChooserParams& params) | 369 const content::FileChooserParams& params) override; |
| 370 override; | 370 bool IsPopupOrPanel(const content::WebContents* source) const override; |
| 371 virtual bool IsPopupOrPanel(const content::WebContents* source) | 371 void MoveContents(content::WebContents* source, |
| 372 const override; | 372 const gfx::Rect& pos) override; |
| 373 virtual void MoveContents(content::WebContents* source, | 373 void NavigationStateChanged(const content::WebContents* source, |
| 374 const gfx::Rect& pos) override; | 374 content::InvalidateTypes changed_flags) override; |
| 375 virtual void NavigationStateChanged( | 375 void ToggleFullscreenModeForTab(content::WebContents* source, |
| 376 const content::WebContents* source, | 376 bool enter_fullscreen) override; |
| 377 content::InvalidateTypes changed_flags) override; | 377 bool IsFullscreenForTabOrPending( |
| 378 virtual void ToggleFullscreenModeForTab(content::WebContents* source, | 378 const content::WebContents* source) const override; |
| 379 bool enter_fullscreen) override; | 379 void RequestMediaAccessPermission( |
| 380 virtual bool IsFullscreenForTabOrPending(const content::WebContents* source) | |
| 381 const override; | |
| 382 virtual void RequestMediaAccessPermission( | |
| 383 content::WebContents* web_contents, | 380 content::WebContents* web_contents, |
| 384 const content::MediaStreamRequest& request, | 381 const content::MediaStreamRequest& request, |
| 385 const content::MediaResponseCallback& callback) override; | 382 const content::MediaResponseCallback& callback) override; |
| 386 virtual bool CheckMediaAccessPermission( | 383 bool CheckMediaAccessPermission(content::WebContents* web_contents, |
| 387 content::WebContents* web_contents, | 384 const GURL& security_origin, |
| 388 const GURL& security_origin, | 385 content::MediaStreamType type) override; |
| 389 content::MediaStreamType type) override; | 386 content::WebContents* OpenURLFromTab( |
| 390 virtual content::WebContents* OpenURLFromTab( | |
| 391 content::WebContents* source, | 387 content::WebContents* source, |
| 392 const content::OpenURLParams& params) override; | 388 const content::OpenURLParams& params) override; |
| 393 virtual void AddNewContents(content::WebContents* source, | 389 void AddNewContents(content::WebContents* source, |
| 394 content::WebContents* new_contents, | 390 content::WebContents* new_contents, |
| 395 WindowOpenDisposition disposition, | 391 WindowOpenDisposition disposition, |
| 396 const gfx::Rect& initial_pos, | 392 const gfx::Rect& initial_pos, |
| 397 bool user_gesture, | 393 bool user_gesture, |
| 398 bool* was_blocked) override; | 394 bool* was_blocked) override; |
| 399 virtual bool PreHandleKeyboardEvent( | 395 bool PreHandleKeyboardEvent(content::WebContents* source, |
| 396 const content::NativeWebKeyboardEvent& event, |
| 397 bool* is_keyboard_shortcut) override; |
| 398 void HandleKeyboardEvent( |
| 400 content::WebContents* source, | 399 content::WebContents* source, |
| 401 const content::NativeWebKeyboardEvent& event, | 400 const content::NativeWebKeyboardEvent& event) override; |
| 402 bool* is_keyboard_shortcut) override; | 401 void RequestToLockMouse(content::WebContents* web_contents, |
| 403 virtual void HandleKeyboardEvent(content::WebContents* source, | 402 bool user_gesture, |
| 404 const content::NativeWebKeyboardEvent& event) | 403 bool last_unlocked_by_target) override; |
| 405 override; | 404 bool PreHandleGestureEvent(content::WebContents* source, |
| 406 virtual void RequestToLockMouse(content::WebContents* web_contents, | 405 const blink::WebGestureEvent& event) override; |
| 407 bool user_gesture, | |
| 408 bool last_unlocked_by_target) override; | |
| 409 virtual bool PreHandleGestureEvent(content::WebContents* source, | |
| 410 const blink::WebGestureEvent& event) | |
| 411 override; | |
| 412 | 406 |
| 413 // content::WebContentsObserver implementation. | 407 // content::WebContentsObserver implementation. |
| 414 virtual void DidFirstVisuallyNonEmptyPaint() override; | 408 void DidFirstVisuallyNonEmptyPaint() override; |
| 415 | 409 |
| 416 // content::NotificationObserver implementation. | 410 // content::NotificationObserver implementation. |
| 417 virtual void Observe(int type, | 411 void Observe(int type, |
| 418 const content::NotificationSource& source, | 412 const content::NotificationSource& source, |
| 419 const content::NotificationDetails& details) override; | 413 const content::NotificationDetails& details) override; |
| 420 | 414 |
| 421 // web_modal::WebContentsModalDialogManagerDelegate implementation. | 415 // web_modal::WebContentsModalDialogManagerDelegate implementation. |
| 422 virtual void SetWebContentsBlocked(content::WebContents* web_contents, | 416 void SetWebContentsBlocked(content::WebContents* web_contents, |
| 423 bool blocked) override; | 417 bool blocked) override; |
| 424 virtual bool IsWebContentsVisible(content::WebContents* web_contents) | 418 bool IsWebContentsVisible(content::WebContents* web_contents) override; |
| 425 override; | |
| 426 | 419 |
| 427 // Saves the window geometry/position/screen bounds. | 420 // Saves the window geometry/position/screen bounds. |
| 428 void SaveWindowPosition(); | 421 void SaveWindowPosition(); |
| 429 | 422 |
| 430 // Helper method to adjust the cached bounds so that we can make sure it can | 423 // Helper method to adjust the cached bounds so that we can make sure it can |
| 431 // be visible on the screen. See http://crbug.com/145752. | 424 // be visible on the screen. See http://crbug.com/145752. |
| 432 void AdjustBoundsToBeVisibleOnScreen(const gfx::Rect& cached_bounds, | 425 void AdjustBoundsToBeVisibleOnScreen(const gfx::Rect& cached_bounds, |
| 433 const gfx::Rect& cached_screen_bounds, | 426 const gfx::Rect& cached_screen_bounds, |
| 434 const gfx::Rect& current_screen_bounds, | 427 const gfx::Rect& current_screen_bounds, |
| 435 const gfx::Size& minimum_size, | 428 const gfx::Size& minimum_size, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 450 bool IntersectsWithTaskbar() const; | 443 bool IntersectsWithTaskbar() const; |
| 451 | 444 |
| 452 // Update the always-on-top bit in the native app window. | 445 // Update the always-on-top bit in the native app window. |
| 453 void UpdateNativeAlwaysOnTop(); | 446 void UpdateNativeAlwaysOnTop(); |
| 454 | 447 |
| 455 // Sends the onWindowShown event to the app if the window has been shown. Only | 448 // Sends the onWindowShown event to the app if the window has been shown. Only |
| 456 // has an effect in tests. | 449 // has an effect in tests. |
| 457 void SendOnWindowShownIfShown(); | 450 void SendOnWindowShownIfShown(); |
| 458 | 451 |
| 459 // web_modal::WebContentsModalDialogManagerDelegate implementation. | 452 // web_modal::WebContentsModalDialogManagerDelegate implementation. |
| 460 virtual web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost() | 453 web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost() |
| 461 override; | 454 override; |
| 462 | 455 |
| 463 // Updates the badge to |image|. Called internally from the image loader | 456 // Updates the badge to |image|. Called internally from the image loader |
| 464 // callback. | 457 // callback. |
| 465 void UpdateBadgeIcon(const gfx::Image& image); | 458 void UpdateBadgeIcon(const gfx::Image& image); |
| 466 | 459 |
| 467 // Callback from web_contents()->DownloadFavicon. | 460 // Callback from web_contents()->DownloadFavicon. |
| 468 void DidDownloadFavicon(int id, | 461 void DidDownloadFavicon(int id, |
| 469 int http_status_code, | 462 int http_status_code, |
| 470 const GURL& image_url, | 463 const GURL& image_url, |
| 471 const std::vector<SkBitmap>& bitmaps, | 464 const std::vector<SkBitmap>& bitmaps, |
| 472 const std::vector<gfx::Size>& original_bitmap_sizes); | 465 const std::vector<gfx::Size>& original_bitmap_sizes); |
| 473 | 466 |
| 474 // IconImage::Observer implementation. | 467 // IconImage::Observer implementation. |
| 475 virtual void OnExtensionIconImageChanged(IconImage* image) override; | 468 void OnExtensionIconImageChanged(IconImage* image) override; |
| 476 | 469 |
| 477 // The browser context with which this window is associated. AppWindow does | 470 // The browser context with which this window is associated. AppWindow does |
| 478 // not own this object. | 471 // not own this object. |
| 479 content::BrowserContext* browser_context_; | 472 content::BrowserContext* browser_context_; |
| 480 | 473 |
| 481 const std::string extension_id_; | 474 const std::string extension_id_; |
| 482 | 475 |
| 483 // Identifier that is used when saving and restoring geometry for this | 476 // Identifier that is used when saving and restoring geometry for this |
| 484 // window. | 477 // window. |
| 485 std::string window_key_; | 478 std::string window_key_; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 | 547 |
| 555 // Whether |alpha_enabled| was set in the CreateParams. | 548 // Whether |alpha_enabled| was set in the CreateParams. |
| 556 bool requested_alpha_enabled_; | 549 bool requested_alpha_enabled_; |
| 557 | 550 |
| 558 DISALLOW_COPY_AND_ASSIGN(AppWindow); | 551 DISALLOW_COPY_AND_ASSIGN(AppWindow); |
| 559 }; | 552 }; |
| 560 | 553 |
| 561 } // namespace extensions | 554 } // namespace extensions |
| 562 | 555 |
| 563 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ | 556 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ |
| OLD | NEW |