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

Side by Side Diff: chrome/browser/extensions/api/notifications/notifications_api.cc

Issue 2335293002: ShouldDisplayOverFullscreen implementation (Closed)
Patch Set: Rebasing to try to get patch to compile Created 4 years, 3 months 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/notifications/notifications_apitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/api/notifications/notifications_api.h" 5 #include "chrome/browser/extensions/api/notifications/notifications_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 13 matching lines...) Expand all
24 #include "chrome/browser/notifications/notification_ui_manager.h" 24 #include "chrome/browser/notifications/notification_ui_manager.h"
25 #include "chrome/browser/notifications/notifier_state_tracker.h" 25 #include "chrome/browser/notifications/notifier_state_tracker.h"
26 #include "chrome/browser/notifications/notifier_state_tracker_factory.h" 26 #include "chrome/browser/notifications/notifier_state_tracker_factory.h"
27 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/common/extensions/api/notifications/notification_style.h" 28 #include "chrome/common/extensions/api/notifications/notification_style.h"
29 #include "components/keyed_service/content/browser_context_keyed_service_shutdow n_notifier_factory.h" 29 #include "components/keyed_service/content/browser_context_keyed_service_shutdow n_notifier_factory.h"
30 #include "components/keyed_service/core/keyed_service_shutdown_notifier.h" 30 #include "components/keyed_service/core/keyed_service_shutdown_notifier.h"
31 #include "content/public/browser/render_process_host.h" 31 #include "content/public/browser/render_process_host.h"
32 #include "content/public/browser/render_view_host.h" 32 #include "content/public/browser/render_view_host.h"
33 #include "content/public/browser/web_contents.h" 33 #include "content/public/browser/web_contents.h"
34 #include "extensions/browser/app_window/app_window.h"
35 #include "extensions/browser/app_window/app_window_registry.h"
36 #include "extensions/browser/app_window/native_app_window.h"
34 #include "extensions/browser/event_router.h" 37 #include "extensions/browser/event_router.h"
35 #include "extensions/browser/extension_system_provider.h" 38 #include "extensions/browser/extension_system_provider.h"
36 #include "extensions/browser/extensions_browser_client.h" 39 #include "extensions/browser/extensions_browser_client.h"
37 #include "extensions/common/extension.h" 40 #include "extensions/common/extension.h"
38 #include "extensions/common/features/feature.h" 41 #include "extensions/common/features/feature.h"
39 #include "third_party/skia/include/core/SkBitmap.h" 42 #include "third_party/skia/include/core/SkBitmap.h"
40 #include "ui/base/layout.h" 43 #include "ui/base/layout.h"
41 #include "ui/gfx/image/image.h" 44 #include "ui/gfx/image/image.h"
42 #include "ui/gfx/image/image_skia.h" 45 #include "ui/gfx/image/image_skia.h"
43 #include "ui/gfx/image/image_skia_operations.h" 46 #include "ui/gfx/image/image_skia_operations.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 void ButtonClick(int index) override { 184 void ButtonClick(int index) override {
182 std::unique_ptr<base::ListValue> args(CreateBaseEventArgs()); 185 std::unique_ptr<base::ListValue> args(CreateBaseEventArgs());
183 args->AppendInteger(index); 186 args->AppendInteger(index);
184 SendEvent(events::NOTIFICATIONS_ON_BUTTON_CLICKED, 187 SendEvent(events::NOTIFICATIONS_ON_BUTTON_CLICKED,
185 notifications::OnButtonClicked::kEventName, 188 notifications::OnButtonClicked::kEventName,
186 EventRouter::USER_GESTURE_ENABLED, std::move(args)); 189 EventRouter::USER_GESTURE_ENABLED, std::move(args));
187 } 190 }
188 191
189 std::string id() const override { return scoped_id_; } 192 std::string id() const override { return scoped_id_; }
190 193
194 // Should only display when fullscreen if this app is the source of the
195 // fullscreen window.
196 bool ShouldDisplayOverFullscreen() const override {
197 AppWindowRegistry::AppWindowList windows = AppWindowRegistry::Get(
198 api_function_->GetProfile())->GetAppWindowsForApp(extension_id_);
199 for (const auto& window : windows) {
200 // Window must be fullscreen and visible
201 if (window->IsFullscreen() && window->GetBaseWindow()->IsActive())
202 return true;
203 }
204 return false;
205 }
206
191 private: 207 private:
192 ~NotificationsApiDelegate() override {} 208 ~NotificationsApiDelegate() override {}
193 209
194 void SendEvent(events::HistogramValue histogram_value, 210 void SendEvent(events::HistogramValue histogram_value,
195 const std::string& name, 211 const std::string& name,
196 EventRouter::UserGestureState user_gesture, 212 EventRouter::UserGestureState user_gesture,
197 std::unique_ptr<base::ListValue> args) { 213 std::unique_ptr<base::ListValue> args) {
198 if (!event_router_) 214 if (!event_router_)
199 return; 215 return;
200 216
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 : api::notifications::PERMISSION_LEVEL_DENIED; 738 : api::notifications::PERMISSION_LEVEL_DENIED;
723 739
724 SetResult(base::MakeUnique<base::StringValue>( 740 SetResult(base::MakeUnique<base::StringValue>(
725 api::notifications::ToString(result))); 741 api::notifications::ToString(result)));
726 SendResponse(true); 742 SendResponse(true);
727 743
728 return true; 744 return true;
729 } 745 }
730 746
731 } // namespace extensions 747 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/notifications/notifications_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698