OLD | NEW |
---|---|
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 "chrome/browser/win/jumplist_updater.h" | 5 #include "chrome/browser/win/jumplist_updater.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <propkey.h> | 8 #include <propkey.h> |
9 #include <shobjidl.h> | 9 #include <shobjidl.h> |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 JumpListUpdater::JumpListUpdater(const std::wstring& app_user_model_id) | 103 JumpListUpdater::JumpListUpdater(const std::wstring& app_user_model_id) |
104 : app_user_model_id_(app_user_model_id), | 104 : app_user_model_id_(app_user_model_id), |
105 user_max_items_(0) { | 105 user_max_items_(0) { |
106 } | 106 } |
107 | 107 |
108 JumpListUpdater::~JumpListUpdater() { | 108 JumpListUpdater::~JumpListUpdater() { |
109 } | 109 } |
110 | 110 |
111 // static | 111 // static |
112 bool JumpListUpdater::IsEnabled() { | 112 bool JumpListUpdater::IsEnabled() { |
113 // JumpList is implemented only on Windows 7 or later. | |
114 // Do not create custom JumpLists in tests. See http://crbug.com/389375. | 113 // Do not create custom JumpLists in tests. See http://crbug.com/389375. |
115 return base::win::GetVersion() >= base::win::VERSION_WIN7 && | 114 return base::win::GetVersion() >= base::win::VERSION_WIN7 && |
grt (UTC plus 2)
2017/04/24 09:15:07
please remove this check and "#include "base/win/w
chengx
2017/04/24 17:24:40
Done.
| |
116 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 115 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
117 switches::kTestType); | 116 switches::kTestType); |
118 } | 117 } |
119 | 118 |
120 bool JumpListUpdater::BeginUpdate() { | 119 bool JumpListUpdater::BeginUpdate() { |
121 // TODO(chengx): Remove the UMA histogram after fixing http://crbug.com/40407. | 120 // TODO(chengx): Remove the UMA histogram after fixing http://crbug.com/40407. |
122 SCOPED_UMA_HISTOGRAM_TIMER("WinJumplistUpdater.BeginUpdateDuration"); | 121 SCOPED_UMA_HISTOGRAM_TIMER("WinJumplistUpdater.BeginUpdateDuration"); |
123 | 122 |
124 // This instance is expected to be one-time-use only. | 123 // This instance is expected to be one-time-use only. |
125 DCHECK(!destination_list_.Get()); | 124 DCHECK(!destination_list_.Get()); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 // It seems the ICustomDestinationList::AppendCategory() function just | 248 // It seems the ICustomDestinationList::AppendCategory() function just |
250 // replaces all items in the given category with the ones in the new list. | 249 // replaces all items in the given category with the ones in the new list. |
251 base::win::ScopedComPtr<IObjectArray> object_array; | 250 base::win::ScopedComPtr<IObjectArray> object_array; |
252 result = collection.QueryInterface(object_array.Receive()); | 251 result = collection.QueryInterface(object_array.Receive()); |
253 if (FAILED(result)) | 252 if (FAILED(result)) |
254 return false; | 253 return false; |
255 | 254 |
256 return SUCCEEDED(destination_list_->AppendCategory(category_name.c_str(), | 255 return SUCCEEDED(destination_list_->AppendCategory(category_name.c_str(), |
257 object_array.Get())); | 256 object_array.Get())); |
258 } | 257 } |
OLD | NEW |