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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 registrar_.Add(this, | 55 registrar_.Add(this, |
56 chrome::NOTIFICATION_PROFILE_DESTROYED, | 56 chrome::NOTIFICATION_PROFILE_DESTROYED, |
57 content::Source<Profile>(service_->profile())); | 57 content::Source<Profile>(service_->profile())); |
58 } | 58 } |
59 virtual ~ProfileDestroyObserver() {} | 59 virtual ~ProfileDestroyObserver() {} |
60 | 60 |
61 private: | 61 private: |
62 // content::NotificationObserver | 62 // content::NotificationObserver |
63 virtual void Observe(int type, | 63 virtual void Observe(int type, |
64 const content::NotificationSource& source, | 64 const content::NotificationSource& source, |
65 const content::NotificationDetails& details) OVERRIDE { | 65 const content::NotificationDetails& details) override { |
66 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); | 66 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
67 DCHECK_EQ(service_->profile(), content::Source<Profile>(source).ptr()); | 67 DCHECK_EQ(service_->profile(), content::Source<Profile>(source).ptr()); |
68 service_->Shutdown(); | 68 service_->Shutdown(); |
69 } | 69 } |
70 | 70 |
71 StartPageService* service_; // Owner of this class. | 71 StartPageService* service_; // Owner of this class. |
72 content::NotificationRegistrar registrar_; | 72 content::NotificationRegistrar registrar_; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(ProfileDestroyObserver); | 74 DISALLOW_COPY_AND_ASSIGN(ProfileDestroyObserver); |
75 }; | 75 }; |
76 | 76 |
77 class StartPageService::StartPageWebContentsDelegate | 77 class StartPageService::StartPageWebContentsDelegate |
78 : public content::WebContentsDelegate { | 78 : public content::WebContentsDelegate { |
79 public: | 79 public: |
80 StartPageWebContentsDelegate() {} | 80 StartPageWebContentsDelegate() {} |
81 virtual ~StartPageWebContentsDelegate() {} | 81 virtual ~StartPageWebContentsDelegate() {} |
82 | 82 |
83 virtual void RequestMediaAccessPermission( | 83 virtual void RequestMediaAccessPermission( |
84 content::WebContents* web_contents, | 84 content::WebContents* web_contents, |
85 const content::MediaStreamRequest& request, | 85 const content::MediaStreamRequest& request, |
86 const content::MediaResponseCallback& callback) OVERRIDE { | 86 const content::MediaResponseCallback& callback) override { |
87 if (MediaStreamInfoBarDelegate::Create(web_contents, request, callback)) | 87 if (MediaStreamInfoBarDelegate::Create(web_contents, request, callback)) |
88 NOTREACHED() << "Media stream not allowed for WebUI"; | 88 NOTREACHED() << "Media stream not allowed for WebUI"; |
89 } | 89 } |
90 | 90 |
91 virtual bool CheckMediaAccessPermission( | 91 virtual bool CheckMediaAccessPermission( |
92 content::WebContents* web_contents, | 92 content::WebContents* web_contents, |
93 const GURL& security_origin, | 93 const GURL& security_origin, |
94 content::MediaStreamType type) OVERRIDE { | 94 content::MediaStreamType type) override { |
95 return MediaCaptureDevicesDispatcher::GetInstance() | 95 return MediaCaptureDevicesDispatcher::GetInstance() |
96 ->CheckMediaAccessPermission(web_contents, security_origin, type); | 96 ->CheckMediaAccessPermission(web_contents, security_origin, type); |
97 } | 97 } |
98 | 98 |
99 private: | 99 private: |
100 DISALLOW_COPY_AND_ASSIGN(StartPageWebContentsDelegate); | 100 DISALLOW_COPY_AND_ASSIGN(StartPageWebContentsDelegate); |
101 }; | 101 }; |
102 | 102 |
103 // static | 103 // static |
104 StartPageService* StartPageService::Get(Profile* profile) { | 104 StartPageService* StartPageService::Get(Profile* profile) { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 content::Referrer(), | 246 content::Referrer(), |
247 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | 247 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, |
248 std::string()); | 248 std::string()); |
249 } | 249 } |
250 | 250 |
251 void StartPageService::UnloadContents() { | 251 void StartPageService::UnloadContents() { |
252 contents_.reset(); | 252 contents_.reset(); |
253 } | 253 } |
254 | 254 |
255 } // namespace app_list | 255 } // namespace app_list |
OLD | NEW |