Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / translate / translate_bubble_factory.cc
blob95b9e9c640f989800f32b54e7e509f6c6dc9c7fb
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/translate/translate_bubble_factory.h"
7 #include "chrome/browser/ui/browser_finder.h"
8 #include "chrome/browser/ui/browser_window.h"
10 namespace {
12 void ShowDefault(BrowserWindow* window,
13 content::WebContents* web_contents,
14 TranslateBubbleModel::ViewState view_state,
15 TranslateErrors::Type error_type) {
16 // |window| might be null when testing.
17 if (!window)
18 return;
19 window->ShowTranslateBubble(web_contents, view_state, error_type);
22 } // namespace
24 TranslateBubbleFactory::~TranslateBubbleFactory() {
27 // static
28 void TranslateBubbleFactory::Show(BrowserWindow* window,
29 content::WebContents* web_contents,
30 TranslateBubbleModel::ViewState view_state,
31 TranslateErrors::Type error_type) {
32 if (current_factory_) {
33 current_factory_->ShowImplementation(window, web_contents, view_state,
34 error_type);
35 return;
38 ShowDefault(window, web_contents, view_state, error_type);
41 // static
42 void TranslateBubbleFactory::SetFactory(TranslateBubbleFactory* factory) {
43 current_factory_ = factory;
46 // static
47 TranslateBubbleFactory* TranslateBubbleFactory::current_factory_ = NULL;