OLD | NEW |
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 "chrome/browser/ui/intents/web_intent_picker_controller.h" | 5 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 26 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
27 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 27 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
28 #include "chrome/browser/webdata/web_data_service.h" | 28 #include "chrome/browser/webdata/web_data_service.h" |
29 #include "chrome/common/chrome_notification_types.h" | 29 #include "chrome/common/chrome_notification_types.h" |
30 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
31 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
32 #include "content/public/browser/navigation_controller.h" | 32 #include "content/public/browser/navigation_controller.h" |
33 #include "content/public/browser/notification_source.h" | 33 #include "content/public/browser/notification_source.h" |
34 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
35 #include "content/public/browser/web_intents_dispatcher.h" | 35 #include "content/public/browser/web_intents_dispatcher.h" |
36 #include "content/public/common/url_fetcher.h" | |
37 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
38 #include "net/base/load_flags.h" | 37 #include "net/base/load_flags.h" |
| 38 #include "net/url_request/url_fetcher.h" |
39 #include "net/url_request/url_fetcher_delegate.h" | 39 #include "net/url_request/url_fetcher_delegate.h" |
40 #include "skia/ext/image_operations.h" | 40 #include "skia/ext/image_operations.h" |
41 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
42 #include "ui/gfx/codec/png_codec.h" | 42 #include "ui/gfx/codec/png_codec.h" |
43 #include "ui/gfx/favicon_size.h" | 43 #include "ui/gfx/favicon_size.h" |
44 #include "ui/gfx/image/image.h" | 44 #include "ui/gfx/image/image.h" |
45 #include "webkit/glue/web_intent_service_data.h" | 45 #include "webkit/glue/web_intent_service_data.h" |
46 | 46 |
47 namespace { | 47 namespace { |
48 | 48 |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 true)) { // Include disabled. | 553 true)) { // Include disabled. |
554 continue; | 554 continue; |
555 } | 555 } |
556 | 556 |
557 picker_model_->AddSuggestedExtension( | 557 picker_model_->AddSuggestedExtension( |
558 info.name, | 558 info.name, |
559 info.id, | 559 info.id, |
560 info.average_rating); | 560 info.average_rating); |
561 | 561 |
562 pending_async_count_++; | 562 pending_async_count_++; |
563 net::URLFetcher* icon_url_fetcher = content::URLFetcher::Create( | 563 net::URLFetcher* icon_url_fetcher = net::URLFetcher::Create( |
564 0, | 564 0, |
565 info.icon_url, | 565 info.icon_url, |
566 net::URLFetcher::GET, | 566 net::URLFetcher::GET, |
567 new URLFetcherTrampoline( | 567 new URLFetcherTrampoline( |
568 base::Bind( | 568 base::Bind( |
569 &WebIntentPickerController::OnExtensionIconURLFetchComplete, | 569 &WebIntentPickerController::OnExtensionIconURLFetchComplete, |
570 weak_ptr_factory_.GetWeakPtr(), info.id))); | 570 weak_ptr_factory_.GetWeakPtr(), info.id))); |
571 | 571 |
572 icon_url_fetcher->SetLoadFlags( | 572 icon_url_fetcher->SetLoadFlags( |
573 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); | 573 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 // If picker is non-NULL, it was set by a test. | 689 // If picker is non-NULL, it was set by a test. |
690 if (picker_ == NULL) | 690 if (picker_ == NULL) |
691 picker_ = WebIntentPicker::Create(tab_contents_, this, picker_model_.get()); | 691 picker_ = WebIntentPicker::Create(tab_contents_, this, picker_model_.get()); |
692 picker_shown_ = true; | 692 picker_shown_ = true; |
693 } | 693 } |
694 | 694 |
695 void WebIntentPickerController::ClosePicker() { | 695 void WebIntentPickerController::ClosePicker() { |
696 if (picker_) | 696 if (picker_) |
697 picker_->Close(); | 697 picker_->Close(); |
698 } | 698 } |
OLD | NEW |