| 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 "extensions/browser/app_window/app_window.h" | 5 #include "extensions/browser/app_window/app_window.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 image_loader_ptr_factory_.InvalidateWeakPtrs(); | 533 image_loader_ptr_factory_.InvalidateWeakPtrs(); |
| 534 | 534 |
| 535 // Reset |app_icon_image_| to abort pending image load (if any). | 535 // Reset |app_icon_image_| to abort pending image load (if any). |
| 536 app_icon_image_.reset(); | 536 app_icon_image_.reset(); |
| 537 | 537 |
| 538 app_icon_url_ = url; | 538 app_icon_url_ = url; |
| 539 web_contents()->DownloadImage( | 539 web_contents()->DownloadImage( |
| 540 url, | 540 url, |
| 541 true, // is a favicon | 541 true, // is a favicon |
| 542 0, // no maximum size | 542 0, // no maximum size |
| 543 blink::WebURLRequest::UseProtocolCachePolicy, |
| 543 base::Bind(&AppWindow::DidDownloadFavicon, | 544 base::Bind(&AppWindow::DidDownloadFavicon, |
| 544 image_loader_ptr_factory_.GetWeakPtr())); | 545 image_loader_ptr_factory_.GetWeakPtr())); |
| 545 } | 546 } |
| 546 | 547 |
| 547 void AppWindow::SetBadgeIconUrl(const GURL& url) { | 548 void AppWindow::SetBadgeIconUrl(const GURL& url) { |
| 548 // Avoid using any previous icons that were being downloaded. | 549 // Avoid using any previous icons that were being downloaded. |
| 549 image_loader_ptr_factory_.InvalidateWeakPtrs(); | 550 image_loader_ptr_factory_.InvalidateWeakPtrs(); |
| 550 | 551 |
| 551 // Reset |app_icon_image_| to abort pending image load (if any). | 552 // Reset |app_icon_image_| to abort pending image load (if any). |
| 552 badge_icon_image_.reset(); | 553 badge_icon_image_.reset(); |
| 553 | 554 |
| 554 badge_icon_url_ = url; | 555 badge_icon_url_ = url; |
| 555 web_contents()->DownloadImage( | 556 web_contents()->DownloadImage( |
| 556 url, | 557 url, |
| 557 true, // is a favicon | 558 true, // is a favicon |
| 558 0, // no maximum size | 559 0, // no maximum size |
| 560 blink::WebURLRequest::UseProtocolCachePolicy, |
| 559 base::Bind(&AppWindow::DidDownloadFavicon, | 561 base::Bind(&AppWindow::DidDownloadFavicon, |
| 560 image_loader_ptr_factory_.GetWeakPtr())); | 562 image_loader_ptr_factory_.GetWeakPtr())); |
| 561 } | 563 } |
| 562 | 564 |
| 563 void AppWindow::ClearBadge() { | 565 void AppWindow::ClearBadge() { |
| 564 badge_icon_image_.reset(); | 566 badge_icon_image_.reset(); |
| 565 badge_icon_url_ = GURL(); | 567 badge_icon_url_ = GURL(); |
| 566 UpdateBadgeIcon(gfx::Image()); | 568 UpdateBadgeIcon(gfx::Image()); |
| 567 } | 569 } |
| 568 | 570 |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 region.bounds.x(), | 1111 region.bounds.x(), |
| 1110 region.bounds.y(), | 1112 region.bounds.y(), |
| 1111 region.bounds.right(), | 1113 region.bounds.right(), |
| 1112 region.bounds.bottom(), | 1114 region.bounds.bottom(), |
| 1113 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1115 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
| 1114 } | 1116 } |
| 1115 return sk_region; | 1117 return sk_region; |
| 1116 } | 1118 } |
| 1117 | 1119 |
| 1118 } // namespace extensions | 1120 } // namespace extensions |
| OLD | NEW |