| 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 <memory> |
| 9 |
| 9 #include "content/public/browser/web_contents_delegate.h" | 10 #include "content/public/browser/web_contents_delegate.h" |
| 10 | 11 |
| 11 class GURL; | 12 class GURL; |
| 12 | 13 |
| 13 namespace content { | 14 namespace content { |
| 14 class BrowserContext; | 15 class BrowserContext; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace extensions { | 18 namespace extensions { |
| 18 class AppDelegate; | 19 class AppDelegate; |
| 19 class AppWebContentsHelper; | 20 class AppWebContentsHelper; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace apps { | 23 namespace apps { |
| 23 | 24 |
| 24 // Manages the web contents for extension-hosted launcher pages. The | 25 // Manages the web contents for extension-hosted launcher pages. The |
| 25 // implementation for this class should create and maintain the WebContents for | 26 // implementation for this class should create and maintain the WebContents for |
| 26 // the page, and handle any message passing between the web contents and the | 27 // the page, and handle any message passing between the web contents and the |
| 27 // extension system. | 28 // extension system. |
| 28 class CustomLauncherPageContents : public content::WebContentsDelegate { | 29 class CustomLauncherPageContents : public content::WebContentsDelegate { |
| 29 public: | 30 public: |
| 30 CustomLauncherPageContents(scoped_ptr<extensions::AppDelegate> app_delegate, | 31 CustomLauncherPageContents( |
| 31 const std::string& extension_id); | 32 std::unique_ptr<extensions::AppDelegate> app_delegate, |
| 33 const std::string& extension_id); |
| 32 ~CustomLauncherPageContents() override; | 34 ~CustomLauncherPageContents() override; |
| 33 | 35 |
| 34 // Called to initialize and load the WebContents. | 36 // Called to initialize and load the WebContents. |
| 35 void Initialize(content::BrowserContext* context, const GURL& url); | 37 void Initialize(content::BrowserContext* context, const GURL& url); |
| 36 | 38 |
| 37 content::WebContents* web_contents() const { return web_contents_.get(); } | 39 content::WebContents* web_contents() const { return web_contents_.get(); } |
| 38 | 40 |
| 39 // content::WebContentsDelegate overrides: | 41 // content::WebContentsDelegate overrides: |
| 40 content::WebContents* OpenURLFromTab( | 42 content::WebContents* OpenURLFromTab( |
| 41 content::WebContents* source, | 43 content::WebContents* source, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 61 bool last_unlocked_by_target) override; | 63 bool last_unlocked_by_target) override; |
| 62 void RequestMediaAccessPermission( | 64 void RequestMediaAccessPermission( |
| 63 content::WebContents* web_contents, | 65 content::WebContents* web_contents, |
| 64 const content::MediaStreamRequest& request, | 66 const content::MediaStreamRequest& request, |
| 65 const content::MediaResponseCallback& callback) override; | 67 const content::MediaResponseCallback& callback) override; |
| 66 bool CheckMediaAccessPermission(content::WebContents* web_contents, | 68 bool CheckMediaAccessPermission(content::WebContents* web_contents, |
| 67 const GURL& security_origin, | 69 const GURL& security_origin, |
| 68 content::MediaStreamType type) override; | 70 content::MediaStreamType type) override; |
| 69 | 71 |
| 70 private: | 72 private: |
| 71 scoped_ptr<content::WebContents> web_contents_; | 73 std::unique_ptr<content::WebContents> web_contents_; |
| 72 scoped_ptr<extensions::AppDelegate> app_delegate_; | 74 std::unique_ptr<extensions::AppDelegate> app_delegate_; |
| 73 scoped_ptr<extensions::AppWebContentsHelper> helper_; | 75 std::unique_ptr<extensions::AppWebContentsHelper> helper_; |
| 74 | 76 |
| 75 std::string extension_id_; | 77 std::string extension_id_; |
| 76 | 78 |
| 77 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageContents); | 79 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageContents); |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 } // namespace apps | 82 } // namespace apps |
| 81 | 83 |
| 82 #endif // APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ | 84 #endif // APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ |
| OLD | NEW |