| 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 16 matching lines...) Expand all Loading... |
| 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" | 36 #include "content/public/common/url_fetcher.h" |
| 37 #include "content/public/common/url_fetcher_delegate.h" | |
| 38 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
| 39 #include "net/base/load_flags.h" | 38 #include "net/base/load_flags.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 |
| 49 const char kShareActionURL[] = "http://webintents.org/share"; | 49 const char kShareActionURL[] = "http://webintents.org/share"; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 return l10n_util::GetStringUTF16(IDS_WEB_INTENTS_ACTION_PICK); | 93 return l10n_util::GetStringUTF16(IDS_WEB_INTENTS_ACTION_PICK); |
| 94 else if (!action.compare(kSubscribeActionURL)) | 94 else if (!action.compare(kSubscribeActionURL)) |
| 95 return l10n_util::GetStringUTF16(IDS_WEB_INTENTS_ACTION_SUBSCRIBE); | 95 return l10n_util::GetStringUTF16(IDS_WEB_INTENTS_ACTION_SUBSCRIBE); |
| 96 else if (!action.compare(kSaveActionURL)) | 96 else if (!action.compare(kSaveActionURL)) |
| 97 return l10n_util::GetStringUTF16(IDS_WEB_INTENTS_ACTION_SAVE); | 97 return l10n_util::GetStringUTF16(IDS_WEB_INTENTS_ACTION_SAVE); |
| 98 else | 98 else |
| 99 return l10n_util::GetStringUTF16(IDS_INTENT_PICKER_CHOOSE_SERVICE); | 99 return l10n_util::GetStringUTF16(IDS_INTENT_PICKER_CHOOSE_SERVICE); |
| 100 } | 100 } |
| 101 | 101 |
| 102 // Self-deleting trampoline that forwards A URLFetcher response to a callback. | 102 // Self-deleting trampoline that forwards A URLFetcher response to a callback. |
| 103 class URLFetcherTrampoline : public content::URLFetcherDelegate { | 103 class URLFetcherTrampoline : public net::URLFetcherDelegate { |
| 104 public: | 104 public: |
| 105 typedef base::Callback<void(const net::URLFetcher* source)> | 105 typedef base::Callback<void(const net::URLFetcher* source)> |
| 106 ForwardingCallback; | 106 ForwardingCallback; |
| 107 | 107 |
| 108 explicit URLFetcherTrampoline(const ForwardingCallback& callback); | 108 explicit URLFetcherTrampoline(const ForwardingCallback& callback); |
| 109 ~URLFetcherTrampoline(); | 109 ~URLFetcherTrampoline(); |
| 110 | 110 |
| 111 // content::URLFetcherDelegate implementation. | 111 // net::URLFetcherDelegate implementation. |
| 112 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 112 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
| 113 | 113 |
| 114 private: | 114 private: |
| 115 // Fowarding callback from |OnURLFetchComplete|. | 115 // Fowarding callback from |OnURLFetchComplete|. |
| 116 ForwardingCallback callback_; | 116 ForwardingCallback callback_; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 URLFetcherTrampoline::URLFetcherTrampoline(const ForwardingCallback& callback) | 119 URLFetcherTrampoline::URLFetcherTrampoline(const ForwardingCallback& callback) |
| 120 : callback_(callback) { | 120 : callback_(callback) { |
| 121 } | 121 } |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 // If picker is non-NULL, it was set by a test. | 688 // If picker is non-NULL, it was set by a test. |
| 689 if (picker_ == NULL) | 689 if (picker_ == NULL) |
| 690 picker_ = WebIntentPicker::Create(wrapper_, this, picker_model_.get()); | 690 picker_ = WebIntentPicker::Create(wrapper_, this, picker_model_.get()); |
| 691 picker_shown_ = true; | 691 picker_shown_ = true; |
| 692 } | 692 } |
| 693 | 693 |
| 694 void WebIntentPickerController::ClosePicker() { | 694 void WebIntentPickerController::ClosePicker() { |
| 695 if (picker_) | 695 if (picker_) |
| 696 picker_->Close(); | 696 picker_->Close(); |
| 697 } | 697 } |
| OLD | NEW |