- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / views / omnibox / omnibox_views.cc
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/omnibox/omnibox_views.h"
6
7 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h"
8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
9 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
10 #include "ui/views/controls/textfield/textfield.h"
11
12 #if defined(OS_WIN) && !defined(USE_AURA)
13 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h"
14 #endif
15
16 OmniboxViewViews* GetOmniboxViewViews(OmniboxView* view) {
17   return views::Textfield::IsViewsTextfieldEnabled() ?
18       static_cast<OmniboxViewViews*>(view) : NULL;
19 }
20
21 OmniboxViewWin* GetOmniboxViewWin(OmniboxView* view) {
22 #if defined(OS_WIN) && !defined(USE_AURA)
23   return views::Textfield::IsViewsTextfieldEnabled() ?
24       NULL : static_cast<OmniboxViewWin*>(view);
25 #else
26   return NULL;
27 #endif
28 }
29
30 OmniboxView* CreateOmniboxView(OmniboxEditController* controller,
31                                Profile* profile,
32                                CommandUpdater* command_updater,
33                                bool popup_window_mode,
34                                LocationBarView* location_bar,
35                                const gfx::FontList& font_list) {
36 #if defined(OS_WIN) && !defined(USE_AURA)
37   if (!views::Textfield::IsViewsTextfieldEnabled()) {
38     return new OmniboxViewWin(controller, location_bar, command_updater,
39                               popup_window_mode, font_list);
40   }
41 #endif
42   OmniboxViewViews* omnibox = new OmniboxViewViews(
43       controller, profile, command_updater, popup_window_mode, location_bar,
44       font_list);
45   omnibox->Init();
46   return omnibox;
47 }