Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: content/shell/browser/layout_test/layout_test_content_browser_client.cc

Issue 774573003: Start pulling away notification logic from ChromeContentBrowserClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "content/shell/browser/layout_test/layout_test_content_browser_client.h " 5 #include "content/shell/browser/layout_test/layout_test_content_browser_client.h "
6 6
7 #include "content/public/browser/browser_context.h" 7 #include "content/public/browser/browser_context.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 #include "content/public/browser/render_process_host.h" 9 #include "content/public/browser/render_process_host.h"
10 #include "content/public/browser/storage_partition.h" 10 #include "content/public/browser/storage_partition.h"
(...skipping 21 matching lines...) Expand all
32 BrowserThread::UI, 32 BrowserThread::UI,
33 FROM_HERE, 33 FROM_HERE,
34 base::Bind(callback, allowed)); 34 base::Bind(callback, allowed));
35 } 35 }
36 36
37 } // namespace 37 } // namespace
38 38
39 LayoutTestContentBrowserClient::LayoutTestContentBrowserClient() { 39 LayoutTestContentBrowserClient::LayoutTestContentBrowserClient() {
40 DCHECK(!g_layout_test_browser_client); 40 DCHECK(!g_layout_test_browser_client);
41 41
42 layout_test_notification_manager_.reset( 42 layout_test_notification_manager_.reset(new LayoutTestNotificationManager());
43 new LayoutTestNotificationManager());
44 43
45 g_layout_test_browser_client = this; 44 g_layout_test_browser_client = this;
46 } 45 }
47 46
48 LayoutTestContentBrowserClient::~LayoutTestContentBrowserClient() { 47 LayoutTestContentBrowserClient::~LayoutTestContentBrowserClient() {
49 g_layout_test_browser_client = nullptr; 48 g_layout_test_browser_client = nullptr;
50 } 49 }
51 50
52 LayoutTestContentBrowserClient* LayoutTestContentBrowserClient::Get() { 51 LayoutTestContentBrowserClient* LayoutTestContentBrowserClient::Get() {
53 return g_layout_test_browser_client; 52 return g_layout_test_browser_client;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 return; 90 return;
92 } 91 }
93 ShellContentBrowserClient::RequestPermission(permission, 92 ShellContentBrowserClient::RequestPermission(permission,
94 web_contents, 93 web_contents,
95 bridge_id, 94 bridge_id,
96 requesting_frame, 95 requesting_frame,
97 user_gesture, 96 user_gesture,
98 result_callback); 97 result_callback);
99 } 98 }
100 99
101 blink::WebNotificationPermission 100 PlatformNotificationService*
102 LayoutTestContentBrowserClient::CheckDesktopNotificationPermission( 101 LayoutTestContentBrowserClient::GetPlatformNotificationService() {
103 const GURL& source_url, 102 return layout_test_notification_manager_.get();
104 ResourceContext* context,
105 int render_process_id) {
106 LayoutTestNotificationManager* manager = GetLayoutTestNotificationManager();
107 if (manager)
108 return manager->CheckPermission(source_url);
109
110 return blink::WebNotificationPermissionAllowed;
111 }
112
113 void LayoutTestContentBrowserClient::ShowDesktopNotification(
114 const ShowDesktopNotificationHostMsgParams& params,
115 BrowserContext* browser_context,
116 int render_process_id,
117 scoped_ptr<DesktopNotificationDelegate> delegate,
118 base::Closure* cancel_callback) {
119 if (auto* manager = GetLayoutTestNotificationManager())
120 manager->Show(params, delegate.Pass(), cancel_callback);
121 } 103 }
122 104
123 } // namespace content 105 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698