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

Side by Side Diff: chrome/browser/chromeos/hats/hats_notification_controller.cc

Issue 2763103002: Move ImageDecoder to components/image_fetcher/content (Closed)
Patch Set: Rebased. Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "chrome/browser/chromeos/hats/hats_notification_controller.h" 5 #include "chrome/browser/chromeos/hats/hats_notification_controller.h"
6 6
7 #include "ash/common/system/system_notifier.h" 7 #include "ash/common/system/system_notifier.h"
8 #include "ash/strings/grit/ash_strings.h" 8 #include "ash/strings/grit/ash_strings.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/task_scheduler/post_task.h" 12 #include "base/task_scheduler/post_task.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chromeos/hats/hats_dialog.h" 14 #include "chrome/browser/chromeos/hats/hats_dialog.h"
15 #include "chrome/browser/chromeos/hats/hats_finch_helper.h" 15 #include "chrome/browser/chromeos/hats/hats_finch_helper.h"
16 #include "chrome/browser/chromeos/login/startup_utils.h" 16 #include "chrome/browser/chromeos/login/startup_utils.h"
17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
18 #include "chrome/browser/chromeos/profiles/profile_helper.h" 18 #include "chrome/browser/chromeos/profiles/profile_helper.h"
19 #include "chrome/browser/notifications/notification_ui_manager.h" 19 #include "chrome/browser/notifications/notification_ui_manager.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/search/suggestions/image_decoder_impl.h"
22 #include "chrome/common/chrome_features.h" 21 #include "chrome/common/chrome_features.h"
23 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
24 #include "chrome/grit/theme_resources.h" 23 #include "chrome/grit/theme_resources.h"
25 #include "chromeos/chromeos_switches.h" 24 #include "chromeos/chromeos_switches.h"
26 #include "chromeos/network/network_state.h" 25 #include "chromeos/network/network_state.h"
26 #include "components/image_fetcher/content/image_decoder_impl.h"
27 #include "components/image_fetcher/core/image_fetcher_impl.h" 27 #include "components/image_fetcher/core/image_fetcher_impl.h"
28 #include "components/prefs/pref_service.h" 28 #include "components/prefs/pref_service.h"
29 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
30 #include "ui/base/resource/resource_bundle.h" 30 #include "ui/base/resource/resource_bundle.h"
31 #include "ui/gfx/image/image_skia_rep.h" 31 #include "ui/gfx/image/image_skia_rep.h"
32 #include "ui/message_center/message_center.h" 32 #include "ui/message_center/message_center.h"
33 #include "ui/message_center/notification_types.h" 33 #include "ui/message_center/notification_types.h"
34 #include "ui/strings/grit/ui_strings.h" 34 #include "ui/strings/grit/ui_strings.h"
35 35
36 namespace { 36 namespace {
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 << "state.status=" << state.status << ", " 220 << "state.status=" << state.status << ", "
221 << "state.response_code=" << state.response_code; 221 << "state.response_code=" << state.response_code;
222 // Return if device is not connected to the internet. 222 // Return if device is not connected to the internet.
223 if (state.status != NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE) 223 if (state.status != NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE)
224 return; 224 return;
225 // Remove self as an observer to no longer receive network change updates. 225 // Remove self as an observer to no longer receive network change updates.
226 network_portal_detector::GetInstance()->RemoveObserver(this); 226 network_portal_detector::GetInstance()->RemoveObserver(this);
227 227
228 if (!image_fetcher_) 228 if (!image_fetcher_)
229 image_fetcher_.reset(new image_fetcher::ImageFetcherImpl( 229 image_fetcher_.reset(new image_fetcher::ImageFetcherImpl(
230 base::MakeUnique<suggestions::ImageDecoderImpl>(), 230 base::MakeUnique<image_fetcher::ImageDecoderImpl>(),
231 profile_->GetRequestContext())); 231 profile_->GetRequestContext()));
232 232
233 completed_requests_ = 0; 233 completed_requests_ = 0;
234 234
235 image_fetcher_->StartOrQueueNetworkRequest( 235 image_fetcher_->StartOrQueueNetworkRequest(
236 kImageFetcher1xId, GURL(kGoogleIcon1xUrl), 236 kImageFetcher1xId, GURL(kGoogleIcon1xUrl),
237 base::Bind(&HatsNotificationController::OnImageFetched, 237 base::Bind(&HatsNotificationController::OnImageFetched,
238 weak_pointer_factory_.GetWeakPtr())); 238 weak_pointer_factory_.GetWeakPtr()));
239 image_fetcher_->StartOrQueueNetworkRequest( 239 image_fetcher_->StartOrQueueNetworkRequest(
240 kImageFetcher2xId, GURL(kGoogleIcon2xUrl), 240 kImageFetcher2xId, GURL(kGoogleIcon2xUrl),
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 GURL(kNotificationOriginUrl), kNotificationId, optional, this); 284 GURL(kNotificationOriginUrl), kNotificationId, optional, this);
285 } 285 }
286 286
287 void HatsNotificationController::UpdateLastInteractionTime() { 287 void HatsNotificationController::UpdateLastInteractionTime() {
288 PrefService* pref_service = profile_->GetPrefs(); 288 PrefService* pref_service = profile_->GetPrefs();
289 pref_service->SetInt64(prefs::kHatsLastInteractionTimestamp, 289 pref_service->SetInt64(prefs::kHatsLastInteractionTimestamp,
290 base::Time::Now().ToInternalValue()); 290 base::Time::Now().ToInternalValue());
291 } 291 }
292 292
293 } // namespace chromeos 293 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698