| 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/ui/views/status_icons/status_tray_state_changer_win.h" | 5 #include "chrome/browser/ui/views/status_icons/status_tray_state_changer_win.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return S_OK; | 118 return S_OK; |
| 119 } | 119 } |
| 120 | 120 |
| 121 StatusTrayStateChangerWin::~StatusTrayStateChangerWin() { | 121 StatusTrayStateChangerWin::~StatusTrayStateChangerWin() { |
| 122 DCHECK(CalledOnValidThread()); | 122 DCHECK(CalledOnValidThread()); |
| 123 } | 123 } |
| 124 | 124 |
| 125 bool StatusTrayStateChangerWin::CreateTrayNotify() { | 125 bool StatusTrayStateChangerWin::CreateTrayNotify() { |
| 126 DCHECK(CalledOnValidThread()); | 126 DCHECK(CalledOnValidThread()); |
| 127 | 127 |
| 128 tray_notify_.Release(); // Release so this method can be called more than | 128 tray_notify_.Reset(); // Reset so this method can be called more than once. |
| 129 // once. | |
| 130 | 129 |
| 131 HRESULT hr = tray_notify_.CreateInstance(CLSID_TrayNotify); | 130 HRESULT hr = tray_notify_.CreateInstance(CLSID_TrayNotify); |
| 132 if (FAILED(hr)) | 131 if (FAILED(hr)) |
| 133 return false; | 132 return false; |
| 134 | 133 |
| 135 base::win::ScopedComPtr<ITrayNotifyWin8> tray_notify_win8; | 134 base::win::ScopedComPtr<ITrayNotifyWin8> tray_notify_win8; |
| 136 hr = tray_notify_win8.QueryFrom(tray_notify_.get()); | 135 hr = tray_notify_win8.QueryFrom(tray_notify_.get()); |
| 137 if (SUCCEEDED(hr)) { | 136 if (SUCCEEDED(hr)) { |
| 138 interface_version_ = INTERFACE_VERSION_WIN8; | 137 interface_version_ = INTERFACE_VERSION_WIN8; |
| 139 return true; | 138 return true; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 HRESULT hr = tray_notify.QueryFrom(tray_notify_.get()); | 224 HRESULT hr = tray_notify.QueryFrom(tray_notify_.get()); |
| 226 if (SUCCEEDED(hr)) | 225 if (SUCCEEDED(hr)) |
| 227 tray_notify->SetPreference(notify_item.get()); | 226 tray_notify->SetPreference(notify_item.get()); |
| 228 } else if (interface_version_ == INTERFACE_VERSION_WIN8) { | 227 } else if (interface_version_ == INTERFACE_VERSION_WIN8) { |
| 229 base::win::ScopedComPtr<ITrayNotifyWin8> tray_notify; | 228 base::win::ScopedComPtr<ITrayNotifyWin8> tray_notify; |
| 230 HRESULT hr = tray_notify.QueryFrom(tray_notify_.get()); | 229 HRESULT hr = tray_notify.QueryFrom(tray_notify_.get()); |
| 231 if (SUCCEEDED(hr)) | 230 if (SUCCEEDED(hr)) |
| 232 tray_notify->SetPreference(notify_item.get()); | 231 tray_notify->SetPreference(notify_item.get()); |
| 233 } | 232 } |
| 234 } | 233 } |
| OLD | NEW |