OLD | NEW |
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 #include "chrome/browser/ui/app_list/start_page_service.h" | 5 #include "chrome/browser/ui/app_list/start_page_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 class StartPageService::ProfileDestroyObserver | 51 class StartPageService::ProfileDestroyObserver |
52 : public content::NotificationObserver { | 52 : public content::NotificationObserver { |
53 public: | 53 public: |
54 explicit ProfileDestroyObserver(StartPageService* service) | 54 explicit ProfileDestroyObserver(StartPageService* service) |
55 : service_(service) { | 55 : service_(service) { |
56 registrar_.Add(this, | 56 registrar_.Add(this, |
57 chrome::NOTIFICATION_PROFILE_DESTROYED, | 57 chrome::NOTIFICATION_PROFILE_DESTROYED, |
58 content::Source<Profile>(service_->profile())); | 58 content::Source<Profile>(service_->profile())); |
59 } | 59 } |
60 virtual ~ProfileDestroyObserver() {} | 60 ~ProfileDestroyObserver() override {} |
61 | 61 |
62 private: | 62 private: |
63 // content::NotificationObserver | 63 // content::NotificationObserver |
64 virtual void Observe(int type, | 64 void Observe(int type, |
65 const content::NotificationSource& source, | 65 const content::NotificationSource& source, |
66 const content::NotificationDetails& details) override { | 66 const content::NotificationDetails& details) override { |
67 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); | 67 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
68 DCHECK_EQ(service_->profile(), content::Source<Profile>(source).ptr()); | 68 DCHECK_EQ(service_->profile(), content::Source<Profile>(source).ptr()); |
69 service_->Shutdown(); | 69 service_->Shutdown(); |
70 } | 70 } |
71 | 71 |
72 StartPageService* service_; // Owner of this class. | 72 StartPageService* service_; // Owner of this class. |
73 content::NotificationRegistrar registrar_; | 73 content::NotificationRegistrar registrar_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(ProfileDestroyObserver); | 75 DISALLOW_COPY_AND_ASSIGN(ProfileDestroyObserver); |
76 }; | 76 }; |
77 | 77 |
78 class StartPageService::StartPageWebContentsDelegate | 78 class StartPageService::StartPageWebContentsDelegate |
79 : public content::WebContentsDelegate { | 79 : public content::WebContentsDelegate { |
80 public: | 80 public: |
81 StartPageWebContentsDelegate() {} | 81 StartPageWebContentsDelegate() {} |
82 virtual ~StartPageWebContentsDelegate() {} | 82 ~StartPageWebContentsDelegate() override {} |
83 | 83 |
84 virtual void RequestMediaAccessPermission( | 84 void RequestMediaAccessPermission( |
85 content::WebContents* web_contents, | 85 content::WebContents* web_contents, |
86 const content::MediaStreamRequest& request, | 86 const content::MediaStreamRequest& request, |
87 const content::MediaResponseCallback& callback) override { | 87 const content::MediaResponseCallback& callback) override { |
88 if (MediaStreamInfoBarDelegate::Create(web_contents, request, callback)) | 88 if (MediaStreamInfoBarDelegate::Create(web_contents, request, callback)) |
89 NOTREACHED() << "Media stream not allowed for WebUI"; | 89 NOTREACHED() << "Media stream not allowed for WebUI"; |
90 } | 90 } |
91 | 91 |
92 virtual bool CheckMediaAccessPermission( | 92 bool CheckMediaAccessPermission(content::WebContents* web_contents, |
93 content::WebContents* web_contents, | 93 const GURL& security_origin, |
94 const GURL& security_origin, | 94 content::MediaStreamType type) override { |
95 content::MediaStreamType type) override { | |
96 return MediaCaptureDevicesDispatcher::GetInstance() | 95 return MediaCaptureDevicesDispatcher::GetInstance() |
97 ->CheckMediaAccessPermission(web_contents, security_origin, type); | 96 ->CheckMediaAccessPermission(web_contents, security_origin, type); |
98 } | 97 } |
99 | 98 |
100 private: | 99 private: |
101 DISALLOW_COPY_AND_ASSIGN(StartPageWebContentsDelegate); | 100 DISALLOW_COPY_AND_ASSIGN(StartPageWebContentsDelegate); |
102 }; | 101 }; |
103 | 102 |
104 // static | 103 // static |
105 StartPageService* StartPageService::Get(Profile* profile) { | 104 StartPageService* StartPageService::Get(Profile* profile) { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | 272 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, |
274 std::string()); | 273 std::string()); |
275 } | 274 } |
276 | 275 |
277 void StartPageService::UnloadContents() { | 276 void StartPageService::UnloadContents() { |
278 contents_.reset(); | 277 contents_.reset(); |
279 webui_finished_loading_ = false; | 278 webui_finished_loading_ = false; |
280 } | 279 } |
281 | 280 |
282 } // namespace app_list | 281 } // namespace app_list |
OLD | NEW |