| 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" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/favicon/favicon_service.h" | 12 #include "chrome/browser/favicon/favicon_service.h" |
| 13 #include "chrome/browser/intents/default_web_intent_service.h" | 13 #include "chrome/browser/intents/default_web_intent_service.h" |
| 14 #include "chrome/browser/intents/web_intents_registry_factory.h" | 14 #include "chrome/browser/intents/web_intents_registry_factory.h" |
| 15 #include "chrome/browser/intents/cws_intents_registry_factory.h" | 15 #include "chrome/browser/intents/cws_intents_registry_factory.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/tab_contents/tab_util.h" | 17 #include "chrome/browser/tab_contents/tab_util.h" |
| 18 #include "chrome/browser/tabs/tab_strip_model.h" | 18 #include "chrome/browser/tabs/tab_strip_model.h" |
| 19 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
| 20 #include "chrome/browser/ui/browser_navigator.h" | 20 #include "chrome/browser/ui/browser_navigator.h" |
| 21 #include "chrome/browser/ui/intents/web_intent_picker.h" | 21 #include "chrome/browser/ui/intents/web_intent_picker.h" |
| 22 #include "chrome/browser/ui/intents/web_intent_picker_model.h" | 22 #include "chrome/browser/ui/intents/web_intent_picker_model.h" |
| 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 24 #include "chrome/browser/webdata/web_data_service.h" | 24 #include "chrome/browser/webdata/web_data_service.h" |
| 25 #include "chrome/common/chrome_notification_types.h" | 25 #include "chrome/common/chrome_notification_types.h" |
| 26 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 27 #include "content/public/browser/notification_source.h" | 27 #include "content/public/browser/notification_source.h" |
| 28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
| 29 #include "content/public/browser/web_intents_dispatcher.h" | 29 #include "content/public/browser/web_intents_dispatcher.h" |
| 30 #include "content/public/common/content_url_request_user_data.h" |
| 30 #include "content/public/common/url_fetcher.h" | 31 #include "content/public/common/url_fetcher.h" |
| 31 #include "content/public/common/url_fetcher_delegate.h" | 32 #include "content/public/common/url_fetcher_delegate.h" |
| 32 #include "net/base/load_flags.h" | 33 #include "net/base/load_flags.h" |
| 33 #include "skia/ext/image_operations.h" | 34 #include "skia/ext/image_operations.h" |
| 34 #include "ui/gfx/codec/png_codec.h" | 35 #include "ui/gfx/codec/png_codec.h" |
| 35 #include "ui/gfx/favicon_size.h" | 36 #include "ui/gfx/favicon_size.h" |
| 36 #include "ui/gfx/image/image.h" | 37 #include "ui/gfx/image/image.h" |
| 37 #include "webkit/glue/web_intent_service_data.h" | 38 #include "webkit/glue/web_intent_service_data.h" |
| 38 | 39 |
| 39 namespace { | 40 namespace { |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 content::URLFetcher::GET, | 330 content::URLFetcher::GET, |
| 330 new URLFetcherTrampoline( | 331 new URLFetcherTrampoline( |
| 331 base::Bind( | 332 base::Bind( |
| 332 &WebIntentPickerController::OnExtensionIconURLFetchComplete, | 333 &WebIntentPickerController::OnExtensionIconURLFetchComplete, |
| 333 weak_ptr_factory_.GetWeakPtr(), info.id))); | 334 weak_ptr_factory_.GetWeakPtr(), info.id))); |
| 334 | 335 |
| 335 icon_url_fetcher->SetLoadFlags( | 336 icon_url_fetcher->SetLoadFlags( |
| 336 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); | 337 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); |
| 337 icon_url_fetcher->SetRequestContext( | 338 icon_url_fetcher->SetRequestContext( |
| 338 wrapper_->profile()->GetRequestContext()); | 339 wrapper_->profile()->GetRequestContext()); |
| 340 // No user data, as the request will be cookie-less. |
| 341 icon_url_fetcher->SetContentURLRequestUserData( |
| 342 new content::ContentURLRequestUserData()); |
| 339 icon_url_fetcher->Start(); | 343 icon_url_fetcher->Start(); |
| 340 } | 344 } |
| 341 | 345 |
| 342 AsyncOperationFinished(); | 346 AsyncOperationFinished(); |
| 343 } | 347 } |
| 344 | 348 |
| 345 void WebIntentPickerController::OnExtensionIconURLFetchComplete( | 349 void WebIntentPickerController::OnExtensionIconURLFetchComplete( |
| 346 const string16& extension_id, const content::URLFetcher* source) { | 350 const string16& extension_id, const content::URLFetcher* source) { |
| 347 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 351 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 348 if (source->GetResponseCode() != 200) { | 352 if (source->GetResponseCode() != 200) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 if (--pending_async_count_ == 0) { | 436 if (--pending_async_count_ == 0) { |
| 433 picker_->OnPendingAsyncCompleted(); | 437 picker_->OnPendingAsyncCompleted(); |
| 434 } | 438 } |
| 435 } | 439 } |
| 436 | 440 |
| 437 void WebIntentPickerController::ClosePicker() { | 441 void WebIntentPickerController::ClosePicker() { |
| 438 if (picker_) { | 442 if (picker_) { |
| 439 picker_->Close(); | 443 picker_->Close(); |
| 440 } | 444 } |
| 441 } | 445 } |
| OLD | NEW |