| 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/web_applications/update_shortcut_worker_win.h" | 5 #include "chrome/browser/web_applications/update_shortcut_worker_win.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 void UpdateShortcutWorker::Run() { | 59 void UpdateShortcutWorker::Run() { |
| 60 // Starting by downloading app icon. | 60 // Starting by downloading app icon. |
| 61 DownloadIcon(); | 61 DownloadIcon(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void UpdateShortcutWorker::Observe( | 64 void UpdateShortcutWorker::Observe( |
| 65 int type, | 65 int type, |
| 66 const content::NotificationSource& source, | 66 const content::NotificationSource& source, |
| 67 const content::NotificationDetails& details) { | 67 const content::NotificationDetails& details) { |
| 68 if (type == chrome::NOTIFICATION_TAB_CLOSING && | 68 DCHECK_EQ(chrome::NOTIFICATION_TAB_CLOSING, type); |
| 69 content::Source<NavigationController>(source).ptr() == | 69 |
| 70 &web_contents_->GetController()) { | 70 if (content::Source<NavigationController>(source).ptr() == |
| 71 &web_contents_->GetController()) { |
| 71 // Underlying tab is closing. | 72 // Underlying tab is closing. |
| 72 web_contents_ = NULL; | 73 web_contents_ = nullptr; |
| 73 } | 74 } |
| 74 } | 75 } |
| 75 | 76 |
| 76 void UpdateShortcutWorker::DownloadIcon() { | 77 void UpdateShortcutWorker::DownloadIcon() { |
| 77 // FetchIcon must run on UI thread because it relies on WebContents | 78 // FetchIcon must run on UI thread because it relies on WebContents |
| 78 // to download the icon. | 79 // to download the icon. |
| 79 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 80 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 80 | 81 |
| 81 if (web_contents_ == NULL) { | 82 if (web_contents_ == NULL) { |
| 82 DeleteMe(); // We are done if underlying WebContents is gone. | 83 DeleteMe(); // We are done if underlying WebContents is gone. |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 base::Unretained(this))); | 243 base::Unretained(this))); |
| 243 } | 244 } |
| 244 } | 245 } |
| 245 | 246 |
| 246 void UpdateShortcutWorker::DeleteMeOnUIThread() { | 247 void UpdateShortcutWorker::DeleteMeOnUIThread() { |
| 247 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 248 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 248 delete this; | 249 delete this; |
| 249 } | 250 } |
| 250 | 251 |
| 251 } // namespace web_app | 252 } // namespace web_app |
| OLD | NEW |