| 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 APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ | 5 #ifndef APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ |
| 6 #define APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ | 6 #define APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/public/browser/web_contents_delegate.h" | 9 #include "content/public/browser/web_contents_delegate.h" |
| 10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // implementation for this class should create and maintain the WebContents for | 27 // implementation for this class should create and maintain the WebContents for |
| 28 // the page, and handle any message passing between the web contents and the | 28 // the page, and handle any message passing between the web contents and the |
| 29 // extension system. | 29 // extension system. |
| 30 class CustomLauncherPageContents | 30 class CustomLauncherPageContents |
| 31 : public content::WebContentsDelegate, | 31 : public content::WebContentsDelegate, |
| 32 public content::WebContentsObserver, | 32 public content::WebContentsObserver, |
| 33 public extensions::ExtensionFunctionDispatcher::Delegate { | 33 public extensions::ExtensionFunctionDispatcher::Delegate { |
| 34 public: | 34 public: |
| 35 CustomLauncherPageContents(scoped_ptr<extensions::AppDelegate> app_delegate, | 35 CustomLauncherPageContents(scoped_ptr<extensions::AppDelegate> app_delegate, |
| 36 const std::string& extension_id); | 36 const std::string& extension_id); |
| 37 virtual ~CustomLauncherPageContents(); | 37 ~CustomLauncherPageContents() override; |
| 38 | 38 |
| 39 // Called to initialize and load the WebContents. | 39 // Called to initialize and load the WebContents. |
| 40 void Initialize(content::BrowserContext* context, const GURL& url); | 40 void Initialize(content::BrowserContext* context, const GURL& url); |
| 41 | 41 |
| 42 content::WebContents* web_contents() const { return web_contents_.get(); } | 42 content::WebContents* web_contents() const { return web_contents_.get(); } |
| 43 | 43 |
| 44 // content::WebContentsDelegate overrides: | 44 // content::WebContentsDelegate overrides: |
| 45 virtual content::WebContents* OpenURLFromTab( | 45 content::WebContents* OpenURLFromTab( |
| 46 content::WebContents* source, | 46 content::WebContents* source, |
| 47 const content::OpenURLParams& params) override; | 47 const content::OpenURLParams& params) override; |
| 48 virtual void AddNewContents(content::WebContents* source, | 48 void AddNewContents(content::WebContents* source, |
| 49 content::WebContents* new_contents, | 49 content::WebContents* new_contents, |
| 50 WindowOpenDisposition disposition, | 50 WindowOpenDisposition disposition, |
| 51 const gfx::Rect& initial_pos, | 51 const gfx::Rect& initial_pos, |
| 52 bool user_gesture, | 52 bool user_gesture, |
| 53 bool* was_blocked) override; | 53 bool* was_blocked) override; |
| 54 virtual bool IsPopupOrPanel( | 54 bool IsPopupOrPanel(const content::WebContents* source) const override; |
| 55 const content::WebContents* source) const override; | 55 bool ShouldSuppressDialogs() override; |
| 56 virtual bool ShouldSuppressDialogs() override; | 56 bool PreHandleGestureEvent(content::WebContents* source, |
| 57 virtual bool PreHandleGestureEvent( | 57 const blink::WebGestureEvent& event) override; |
| 58 content::WebContents* source, | 58 content::ColorChooser* OpenColorChooser( |
| 59 const blink::WebGestureEvent& event) override; | |
| 60 virtual content::ColorChooser* OpenColorChooser( | |
| 61 content::WebContents* web_contents, | 59 content::WebContents* web_contents, |
| 62 SkColor color, | 60 SkColor color, |
| 63 const std::vector<content::ColorSuggestion>& suggestions) override; | 61 const std::vector<content::ColorSuggestion>& suggestions) override; |
| 64 virtual void RunFileChooser( | 62 void RunFileChooser(content::WebContents* tab, |
| 65 content::WebContents* tab, | 63 const content::FileChooserParams& params) override; |
| 66 const content::FileChooserParams& params) override; | 64 void RequestToLockMouse(content::WebContents* web_contents, |
| 67 virtual void RequestToLockMouse(content::WebContents* web_contents, | 65 bool user_gesture, |
| 68 bool user_gesture, | 66 bool last_unlocked_by_target) override; |
| 69 bool last_unlocked_by_target) override; | 67 void RequestMediaAccessPermission( |
| 70 virtual void RequestMediaAccessPermission( | |
| 71 content::WebContents* web_contents, | 68 content::WebContents* web_contents, |
| 72 const content::MediaStreamRequest& request, | 69 const content::MediaStreamRequest& request, |
| 73 const content::MediaResponseCallback& callback) override; | 70 const content::MediaResponseCallback& callback) override; |
| 74 virtual bool CheckMediaAccessPermission( | 71 bool CheckMediaAccessPermission(content::WebContents* web_contents, |
| 75 content::WebContents* web_contents, | 72 const GURL& security_origin, |
| 76 const GURL& security_origin, | 73 content::MediaStreamType type) override; |
| 77 content::MediaStreamType type) override; | |
| 78 | 74 |
| 79 private: | 75 private: |
| 80 // content::WebContentsObserver overrides: | 76 // content::WebContentsObserver overrides: |
| 81 virtual bool OnMessageReceived(const IPC::Message& message) override; | 77 bool OnMessageReceived(const IPC::Message& message) override; |
| 82 | 78 |
| 83 // extensions::ExtensionFunctionDispatcher::Delegate overrides: | 79 // extensions::ExtensionFunctionDispatcher::Delegate overrides: |
| 84 virtual extensions::WindowController* GetExtensionWindowController() | 80 extensions::WindowController* GetExtensionWindowController() const override; |
| 85 const override; | 81 content::WebContents* GetAssociatedWebContents() const override; |
| 86 virtual content::WebContents* GetAssociatedWebContents() const override; | |
| 87 | 82 |
| 88 void OnRequest(const ExtensionHostMsg_Request_Params& params); | 83 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
| 89 | 84 |
| 90 scoped_ptr<content::WebContents> web_contents_; | 85 scoped_ptr<content::WebContents> web_contents_; |
| 91 scoped_ptr<extensions::ExtensionFunctionDispatcher> | 86 scoped_ptr<extensions::ExtensionFunctionDispatcher> |
| 92 extension_function_dispatcher_; | 87 extension_function_dispatcher_; |
| 93 scoped_ptr<extensions::AppDelegate> app_delegate_; | 88 scoped_ptr<extensions::AppDelegate> app_delegate_; |
| 94 scoped_ptr<extensions::AppWebContentsHelper> helper_; | 89 scoped_ptr<extensions::AppWebContentsHelper> helper_; |
| 95 | 90 |
| 96 std::string extension_id_; | 91 std::string extension_id_; |
| 97 | 92 |
| 98 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageContents); | 93 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageContents); |
| 99 }; | 94 }; |
| 100 | 95 |
| 101 } // namespace apps | 96 } // namespace apps |
| 102 | 97 |
| 103 #endif // APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ | 98 #endif // APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ |
| OLD | NEW |