| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "chrome/browser/ui/intents/web_intent_picker_delegate.h" | 14 #include "chrome/browser/ui/intents/web_intent_picker_delegate.h" |
| 15 #include "content/common/notification_observer.h" | 15 #include "content/common/notification_observer.h" |
| 16 #include "content/common/notification_registrar.h" | 16 #include "content/common/notification_registrar.h" |
| 17 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
| 18 | 18 |
| 19 class FaviconService; | 19 class FaviconService; |
| 20 class GURL; | 20 class GURL; |
| 21 class SkBitmap; | 21 class SkBitmap; |
| 22 class TabContentsWrapper; | 22 class TabContentsWrapper; |
| 23 class WebDataService; | 23 class WebDataService; |
| 24 class WebIntentPicker; | 24 class WebIntentPicker; |
| 25 class WebIntentPickerFactory; | 25 class WebIntentPickerFactory; |
| 26 struct WebIntentData; | 26 struct WebIntentServiceData; |
| 27 | 27 |
| 28 // Controls the creation of the WebIntentPicker UI and forwards the user's | 28 // Controls the creation of the WebIntentPicker UI and forwards the user's |
| 29 // intent handler choice back to the TabContents object. | 29 // intent handler choice back to the TabContents object. |
| 30 class WebIntentPickerController : public NotificationObserver, | 30 class WebIntentPickerController : public NotificationObserver, |
| 31 public WebIntentPickerDelegate { | 31 public WebIntentPickerDelegate { |
| 32 public: | 32 public: |
| 33 // Takes ownership of |factory|. | 33 // Takes ownership of |factory|. |
| 34 WebIntentPickerController(TabContentsWrapper* wrapper, | 34 WebIntentPickerController(TabContentsWrapper* wrapper, |
| 35 WebIntentPickerFactory* factory); | 35 WebIntentPickerFactory* factory); |
| 36 virtual ~WebIntentPickerController(); | 36 virtual ~WebIntentPickerController(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 52 virtual void OnCancelled() OVERRIDE; | 52 virtual void OnCancelled() OVERRIDE; |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 friend class WebIntentPickerControllerTest; | 55 friend class WebIntentPickerControllerTest; |
| 56 class WebIntentDataFetcher; | 56 class WebIntentDataFetcher; |
| 57 class FaviconFetcher; | 57 class FaviconFetcher; |
| 58 | 58 |
| 59 int pending_async_count() const { return pending_async_count_; } | 59 int pending_async_count() const { return pending_async_count_; } |
| 60 | 60 |
| 61 // Called from the WebIntentDataFetcher when intent data is available. | 61 // Called from the WebIntentDataFetcher when intent data is available. |
| 62 void OnWebIntentDataAvailable(const std::vector<WebIntentData>& intent_data); | 62 void OnWebIntentDataAvailable( |
| 63 const std::vector<WebIntentServiceData>& intent_data); |
| 63 | 64 |
| 64 // Called from the FaviconDataFetcher when a favicon is available. | 65 // Called from the FaviconDataFetcher when a favicon is available. |
| 65 void OnFaviconDataAvailable(size_t index, const SkBitmap& icon_bitmap); | 66 void OnFaviconDataAvailable(size_t index, const SkBitmap& icon_bitmap); |
| 66 | 67 |
| 67 // Called from the FaviconDataFetcher when a favicon is not available. | 68 // Called from the FaviconDataFetcher when a favicon is not available. |
| 68 void OnFaviconDataUnavailable(size_t index); | 69 void OnFaviconDataUnavailable(size_t index); |
| 69 | 70 |
| 70 // Closes the currently active picker. | 71 // Closes the currently active picker. |
| 71 void ClosePicker(); | 72 void ClosePicker(); |
| 72 | 73 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 92 // A list of URLs to display in the UI. | 93 // A list of URLs to display in the UI. |
| 93 std::vector<GURL> urls_; | 94 std::vector<GURL> urls_; |
| 94 | 95 |
| 95 // A count of the outstanding asynchronous calls. | 96 // A count of the outstanding asynchronous calls. |
| 96 int pending_async_count_; | 97 int pending_async_count_; |
| 97 | 98 |
| 98 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); | 99 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); |
| 99 }; | 100 }; |
| 100 | 101 |
| 101 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ | 102 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ |
| OLD | NEW |