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 #include "chrome/browser/ui/translate/translate_bubble_factory.h" | 5 #include "chrome/browser/ui/translate/translate_bubble_factory.h" |
6 | 6 |
7 #include "chrome/browser/ui/browser_finder.h" | 7 #include "chrome/browser/ui/browser_finder.h" |
8 #include "chrome/browser/ui/browser_window.h" | 8 #include "chrome/browser/ui/browser_window.h" |
9 | 9 |
10 namespace { | 10 namespace { |
11 | 11 |
12 void ShowDefault(BrowserWindow* window, | 12 void ShowDefault(BrowserWindow* window, |
13 content::WebContents* web_contents, | 13 content::WebContents* web_contents, |
14 TranslateBubbleModel::ViewState view_state) { | 14 TranslateBubbleModel::ViewState view_state, |
| 15 TranslateErrors::Type error_type) { |
15 // |window| might be null when testing. | 16 // |window| might be null when testing. |
16 if (!window) | 17 if (!window) |
17 return; | 18 return; |
18 window->ShowTranslateBubble(web_contents, view_state); | 19 window->ShowTranslateBubble(web_contents, view_state, error_type); |
19 } | 20 } |
20 | 21 |
21 } // namespace | 22 } // namespace |
22 | 23 |
23 TranslateBubbleFactory::~TranslateBubbleFactory() { | 24 TranslateBubbleFactory::~TranslateBubbleFactory() { |
24 } | 25 } |
25 | 26 |
26 // static | 27 // static |
27 void TranslateBubbleFactory::Show(BrowserWindow* window, | 28 void TranslateBubbleFactory::Show(BrowserWindow* window, |
28 content::WebContents* web_contents, | 29 content::WebContents* web_contents, |
29 TranslateBubbleModel::ViewState view_state) { | 30 TranslateBubbleModel::ViewState view_state, |
| 31 TranslateErrors::Type error_type) { |
30 if (current_factory_) { | 32 if (current_factory_) { |
31 current_factory_->ShowImplementation(window, web_contents, view_state); | 33 current_factory_->ShowImplementation(window, web_contents, view_state, |
| 34 error_type); |
32 return; | 35 return; |
33 } | 36 } |
34 | 37 |
35 ShowDefault(window, web_contents, view_state); | 38 ShowDefault(window, web_contents, view_state, error_type); |
36 } | 39 } |
37 | 40 |
38 // static | 41 // static |
39 void TranslateBubbleFactory::SetFactory(TranslateBubbleFactory* factory) { | 42 void TranslateBubbleFactory::SetFactory(TranslateBubbleFactory* factory) { |
40 current_factory_ = factory; | 43 current_factory_ = factory; |
41 } | 44 } |
42 | 45 |
43 // static | 46 // static |
44 TranslateBubbleFactory* TranslateBubbleFactory::current_factory_ = NULL; | 47 TranslateBubbleFactory* TranslateBubbleFactory::current_factory_ = NULL; |
OLD | NEW |