| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_TRANSLATE_TRANSLATE_BUBBLE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_FACTORY_H_ |
| 6 #define CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_FACTORY_H_ | 6 #define CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_FACTORY_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/translate/chrome_translate_client.h" | 8 #include "chrome/browser/translate/chrome_translate_client.h" |
| 9 #include "chrome/browser/ui/translate/translate_bubble_model.h" | 9 #include "chrome/browser/ui/translate/translate_bubble_model.h" |
| 10 #include "components/translate/core/common/translate_errors.h" | 10 #include "components/translate/core/common/translate_errors.h" |
| 11 | 11 |
| 12 class BrowserWindow; | 12 class BrowserWindow; |
| 13 enum class ShowTranslateBubbleResult; |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 class WebContents; | 16 class WebContents; |
| 16 } | 17 } |
| 17 | 18 |
| 18 // Factory to show the Translate bubble. | 19 // Factory to show the Translate bubble. |
| 19 class TranslateBubbleFactory { | 20 class TranslateBubbleFactory { |
| 20 public: | 21 public: |
| 21 virtual ~TranslateBubbleFactory(); | 22 virtual ~TranslateBubbleFactory(); |
| 22 | 23 |
| 23 // Shows the translate bubble. The behavior depends on the current factory's | 24 // Shows the translate bubble. The behavior depends on the current factory's |
| 24 // implementation. | 25 // implementation. |
| 25 static void Show(BrowserWindow* window, | 26 static ShowTranslateBubbleResult Show( |
| 26 content::WebContents* web_contents, | 27 BrowserWindow* window, |
| 27 translate::TranslateStep step, | 28 content::WebContents* web_contents, |
| 28 translate::TranslateErrors::Type error_type); | 29 translate::TranslateStep step, |
| 30 translate::TranslateErrors::Type error_type); |
| 29 | 31 |
| 30 // Sets the factory to change the behavior how to show the bubble. | 32 // Sets the factory to change the behavior how to show the bubble. |
| 31 // TranslateBubbleFactory doesn't take the ownership of |factory|. | 33 // TranslateBubbleFactory doesn't take the ownership of |factory|. |
| 32 static void SetFactory(TranslateBubbleFactory* factory); | 34 static void SetFactory(TranslateBubbleFactory* factory); |
| 33 | 35 |
| 34 protected: | 36 protected: |
| 35 // Shows the translate bubble. | 37 // Shows the translate bubble. |
| 36 virtual void ShowImplementation( | 38 virtual ShowTranslateBubbleResult ShowImplementation( |
| 37 BrowserWindow* window, | 39 BrowserWindow* window, |
| 38 content::WebContents* web_contents, | 40 content::WebContents* web_contents, |
| 39 translate::TranslateStep step, | 41 translate::TranslateStep step, |
| 40 translate::TranslateErrors::Type error_type) = 0; | 42 translate::TranslateErrors::Type error_type) = 0; |
| 41 | 43 |
| 42 private: | 44 private: |
| 43 static TranslateBubbleFactory* current_factory_; | 45 static TranslateBubbleFactory* current_factory_; |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 #endif // CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_FACTORY_H_ | 48 #endif // CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_FACTORY_H_ |
| OLD | NEW |