| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import "ios/chrome/app/startup_tasks.h" | 5 #import "ios/chrome/app/startup_tasks.h" |
| 6 | 6 |
| 7 #import <MediaPlayer/MediaPlayer.h> | 7 #import <MediaPlayer/MediaPlayer.h> |
| 8 | 8 |
| 9 #import "base/ios/weak_nsobject.h" | 9 #import "base/ios/weak_nsobject.h" |
| 10 #import "base/mac/bind_objc_block.h" | 10 #import "base/mac/bind_objc_block.h" |
| 11 #include "components/bookmarks/browser/startup_task_runner_service.h" | 11 #include "components/bookmarks/browser/startup_task_runner_service.h" |
| 12 #include "components/reading_list/core/reading_list_switches.h" | |
| 13 #import "ios/chrome/app/deferred_initialization_runner.h" | 12 #import "ios/chrome/app/deferred_initialization_runner.h" |
| 14 #include "ios/chrome/app/tests_hook.h" | 13 #include "ios/chrome/app/tests_hook.h" |
| 15 #include "ios/chrome/browser/application_context.h" | 14 #include "ios/chrome/browser/application_context.h" |
| 16 #include "ios/chrome/browser/bookmarks/startup_task_runner_service_factory.h" | 15 #include "ios/chrome/browser/bookmarks/startup_task_runner_service_factory.h" |
| 17 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 16 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 18 #include "ios/chrome/browser/ios_chrome_io_thread.h" | 17 #include "ios/chrome/browser/ios_chrome_io_thread.h" |
| 19 #import "ios/chrome/browser/omaha/omaha_service.h" | 18 #import "ios/chrome/browser/omaha/omaha_service.h" |
| 20 #include "ios/chrome/browser/reading_list/reading_list_download_service.h" | 19 #include "ios/chrome/browser/reading_list/reading_list_download_service.h" |
| 21 #include "ios/chrome/browser/reading_list/reading_list_download_service_factory.
h" | 20 #include "ios/chrome/browser/reading_list/reading_list_download_service_factory.
h" |
| 22 #import "ios/chrome/browser/ui/main/browser_view_information.h" | 21 #import "ios/chrome/browser/ui/main/browser_view_information.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 name:UIApplicationWillResignActiveNotification | 76 name:UIApplicationWillResignActiveNotification |
| 78 object:nil]; | 77 object:nil]; |
| 79 } | 78 } |
| 80 | 79 |
| 81 #pragma mark - Private methods. | 80 #pragma mark - Private methods. |
| 82 | 81 |
| 83 - (void)performDeferredInitializationForBrowserState: | 82 - (void)performDeferredInitializationForBrowserState: |
| 84 (ios::ChromeBrowserState*)browserState { | 83 (ios::ChromeBrowserState*)browserState { |
| 85 ios::StartupTaskRunnerServiceFactory::GetForBrowserState(browserState) | 84 ios::StartupTaskRunnerServiceFactory::GetForBrowserState(browserState) |
| 86 ->StartDeferredTaskRunners(); | 85 ->StartDeferredTaskRunners(); |
| 87 if (reading_list::switches::IsReadingListEnabled()) { | 86 ReadingListDownloadServiceFactory::GetForBrowserState(browserState) |
| 88 ReadingListDownloadServiceFactory::GetForBrowserState(browserState) | 87 ->Initialize(); |
| 89 ->Initialize(); | |
| 90 } | |
| 91 } | 88 } |
| 92 | 89 |
| 93 - (void)applicationWillResignActiveNotification:(NSNotification*)notification { | 90 - (void)applicationWillResignActiveNotification:(NSNotification*)notification { |
| 94 // If the control center is displaying now-playing information from Chrome, | 91 // If the control center is displaying now-playing information from Chrome, |
| 95 // attempt to clear it so that the URL is no longer shown | 92 // attempt to clear it so that the URL is no longer shown |
| 96 // (crbug.com/475820). The now-playing information will not be cleared if | 93 // (crbug.com/475820). The now-playing information will not be cleared if |
| 97 // it's from a different app. | 94 // it's from a different app. |
| 98 NSDictionary* nowPlayingInfo = | 95 NSDictionary* nowPlayingInfo = |
| 99 [[MPNowPlayingInfoCenter defaultCenter] nowPlayingInfo]; | 96 [[MPNowPlayingInfoCenter defaultCenter] nowPlayingInfo]; |
| 100 if (nowPlayingInfo[MPMediaItemPropertyTitle]) { | 97 if (nowPlayingInfo[MPMediaItemPropertyTitle]) { |
| 101 // No need to clear playing info if media is being played but there is no | 98 // No need to clear playing info if media is being played but there is no |
| 102 // way to check if video or audio is playing in web view. | 99 // way to check if video or audio is playing in web view. |
| 103 [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:nil]; | 100 [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:nil]; |
| 104 } | 101 } |
| 105 } | 102 } |
| 106 | 103 |
| 107 @end | 104 @end |
| OLD | NEW |