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

Side by Side Diff: chromeos/dbus/update_engine_client.cc

Issue 614363002: Added Aura notification that relaunch and powerwash is required in case of downgrade. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring of SystemTrayDelegate(Windows|Linux) is delayed. Created 6 years, 2 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 | « chromeos/dbus/update_engine_client.h ('k') | no next file » | 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 "chromeos/dbus/update_engine_client.h" 5 #include "chromeos/dbus/update_engine_client.h"
6 6
7 #include <algorithm>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/callback.h" 10 #include "base/callback.h"
9 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
11 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
12 #include "chromeos/chromeos_switches.h" 15 #include "chromeos/chromeos_switches.h"
13 #include "dbus/bus.h" 16 #include "dbus/bus.h"
14 #include "dbus/message.h" 17 #include "dbus/message.h"
15 #include "dbus/object_path.h" 18 #include "dbus/object_path.h"
16 #include "dbus/object_proxy.h" 19 #include "dbus/object_proxy.h"
17 #include "third_party/cros_system_api/dbus/service_constants.h" 20 #include "third_party/cros_system_api/dbus/service_constants.h"
18 21
19 namespace chromeos { 22 namespace chromeos {
20 23
21 namespace { 24 namespace {
22 25
23 const char kReleaseChannelDev[] = "dev-channel"; 26 const char kReleaseChannelDev[] = "dev-channel";
24 const char kReleaseChannelBeta[] = "beta-channel"; 27 const char kReleaseChannelBeta[] = "beta-channel";
25 const char kReleaseChannelStable[] = "stable-channel"; 28 const char kReleaseChannelStable[] = "stable-channel";
26 29
30 // List of release channels ordered by stability.
31 const char* kReleaseChannelsList[] = {kReleaseChannelDev,
32 kReleaseChannelBeta,
33 kReleaseChannelStable};
34
27 // Delay between successive state transitions during AU. 35 // Delay between successive state transitions during AU.
28 const int kStateTransitionDefaultDelayMs = 3000; 36 const int kStateTransitionDefaultDelayMs = 3000;
29 37
30 // Delay between successive notifications about downloading progress 38 // Delay between successive notifications about downloading progress
31 // during fake AU. 39 // during fake AU.
32 const int kStateTransitionDownloadingDelayMs = 250; 40 const int kStateTransitionDownloadingDelayMs = 250;
33 41
34 // Size of parts of a "new" image which are downloaded each 42 // Size of parts of a "new" image which are downloaded each
35 // |kStateTransitionDownloadingDelayMs| during fake AU. 43 // |kStateTransitionDownloadingDelayMs| during fake AU.
36 const int64_t kDownloadSizeDelta = 1 << 19; 44 const int64_t kDownloadSizeDelta = 1 << 19;
(...skipping 22 matching lines...) Expand all
59 return UpdateEngineClient::UPDATE_STATUS_ATTEMPTING_ROLLBACK; 67 return UpdateEngineClient::UPDATE_STATUS_ATTEMPTING_ROLLBACK;
60 return UpdateEngineClient::UPDATE_STATUS_ERROR; 68 return UpdateEngineClient::UPDATE_STATUS_ERROR;
61 } 69 }
62 70
63 // Used in UpdateEngineClient::EmptyUpdateCheckCallback(). 71 // Used in UpdateEngineClient::EmptyUpdateCheckCallback().
64 void EmptyUpdateCheckCallbackBody( 72 void EmptyUpdateCheckCallbackBody(
65 UpdateEngineClient::UpdateCheckResult unused_result) { 73 UpdateEngineClient::UpdateCheckResult unused_result) {
66 } 74 }
67 75
68 bool IsValidChannel(const std::string& channel) { 76 bool IsValidChannel(const std::string& channel) {
69 return channel == kReleaseChannelDev || 77 return channel == kReleaseChannelDev || channel == kReleaseChannelBeta ||
70 channel == kReleaseChannelBeta || 78 channel == kReleaseChannelStable;
71 channel == kReleaseChannelStable;
72 } 79 }
73 80
74 } // namespace 81 } // namespace
75 82
76 // The UpdateEngineClient implementation used in production. 83 // The UpdateEngineClient implementation used in production.
77 class UpdateEngineClientImpl : public UpdateEngineClient { 84 class UpdateEngineClientImpl : public UpdateEngineClient {
78 public: 85 public:
79 UpdateEngineClientImpl() 86 UpdateEngineClientImpl()
80 : update_engine_proxy_(NULL), last_status_(), weak_ptr_factory_(this) {} 87 : update_engine_proxy_(NULL), last_status_(), weak_ptr_factory_(this) {}
81 88
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 DBusClientImplementationType type) { 561 DBusClientImplementationType type) {
555 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) 562 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION)
556 return new UpdateEngineClientImpl(); 563 return new UpdateEngineClientImpl();
557 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); 564 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type);
558 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestAutoUpdateUI)) 565 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestAutoUpdateUI))
559 return new UpdateEngineClientFakeImpl(); 566 return new UpdateEngineClientFakeImpl();
560 else 567 else
561 return new UpdateEngineClientStubImpl(); 568 return new UpdateEngineClientStubImpl();
562 } 569 }
563 570
571 // static
572 bool UpdateEngineClient::IsTargetChannelMoreStable(
573 const std::string& current_channel,
574 const std::string& target_channel) {
575 auto cix = std::find(kReleaseChannelsList,
576 kReleaseChannelsList + arraysize(kReleaseChannelsList),
577 current_channel);
578 auto tix = std::find(kReleaseChannelsList,
579 kReleaseChannelsList + arraysize(kReleaseChannelsList),
580 target_channel);
581 return tix > cix;
582 }
583
564 } // namespace chromeos 584 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/update_engine_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698