Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 6192007: Remove wstring from views. Part 3: Switch accessibility strings to string16.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/ui/views/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 1862 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 } 1873 }
1874 1874
1875 BrowserTabStripController* tabstrip_controller = 1875 BrowserTabStripController* tabstrip_controller =
1876 new BrowserTabStripController(browser_.get(), model); 1876 new BrowserTabStripController(browser_.get(), model);
1877 1877
1878 if (UseVerticalTabs()) 1878 if (UseVerticalTabs())
1879 tabstrip_ = new SideTabStrip(tabstrip_controller); 1879 tabstrip_ = new SideTabStrip(tabstrip_controller);
1880 else 1880 else
1881 tabstrip_ = new TabStrip(tabstrip_controller); 1881 tabstrip_ = new TabStrip(tabstrip_controller);
1882 1882
1883 tabstrip_->SetAccessibleName( 1883 tabstrip_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_TABSTRIP));
1884 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_TABSTRIP)));
1885 AddChildView(tabstrip_); 1884 AddChildView(tabstrip_);
1886 1885
1887 tabstrip_controller->InitFromModel(tabstrip_); 1886 tabstrip_controller->InitFromModel(tabstrip_);
1888 } 1887 }
1889 1888
1890 /////////////////////////////////////////////////////////////////////////////// 1889 ///////////////////////////////////////////////////////////////////////////////
1891 // BrowserView, private: 1890 // BrowserView, private:
1892 1891
1893 void BrowserView::Init() { 1892 void BrowserView::Init() {
1894 accessible_view_helper_.reset(new AccessibleViewHelper( 1893 accessible_view_helper_.reset(new AccessibleViewHelper(
1895 this, browser_->profile())); 1894 this, browser_->profile()));
1896 1895
1897 SetLayoutManager(CreateLayoutManager()); 1896 SetLayoutManager(CreateLayoutManager());
1898 // Stow a pointer to this object onto the window handle so that we can get 1897 // Stow a pointer to this object onto the window handle so that we can get
1899 // at it later when all we have is a native view. 1898 // at it later when all we have is a native view.
1900 GetWidget()->SetNativeWindowProperty(kBrowserViewKey, this); 1899 GetWidget()->SetNativeWindowProperty(kBrowserViewKey, this);
1901 1900
1902 // Start a hung plugin window detector for this browser object (as long as 1901 // Start a hung plugin window detector for this browser object (as long as
1903 // hang detection is not disabled). 1902 // hang detection is not disabled).
1904 if (!CommandLine::ForCurrentProcess()->HasSwitch( 1903 if (!CommandLine::ForCurrentProcess()->HasSwitch(
1905 switches::kDisableHangMonitor)) { 1904 switches::kDisableHangMonitor)) {
1906 InitHangMonitor(); 1905 InitHangMonitor();
1907 } 1906 }
1908 1907
1909 LoadAccelerators(); 1908 LoadAccelerators();
1910 SetAccessibleName(UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); 1909 SetAccessibleName(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
1911 1910
1912 InitTabStrip(browser_->tabstrip_model()); 1911 InitTabStrip(browser_->tabstrip_model());
1913 1912
1914 toolbar_ = new ToolbarView(browser_.get()); 1913 toolbar_ = new ToolbarView(browser_.get());
1915 AddChildView(toolbar_); 1914 AddChildView(toolbar_);
1916 toolbar_->Init(browser_->profile()); 1915 toolbar_->Init(browser_->profile());
1917 toolbar_->SetAccessibleName( 1916 toolbar_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLBAR));
1918 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLBAR)));
1919 1917
1920 infobar_container_ = new InfoBarContainer(this); 1918 infobar_container_ = new InfoBarContainer(this);
1921 AddChildView(infobar_container_); 1919 AddChildView(infobar_container_);
1922 1920
1923 contents_container_ = new TabContentsContainer; 1921 contents_container_ = new TabContentsContainer;
1924 contents_container_->set_reserved_area_delegate(this); 1922 contents_container_->set_reserved_area_delegate(this);
1925 contents_ = new ContentsContainer(contents_container_); 1923 contents_ = new ContentsContainer(contents_container_);
1926 1924
1927 SkColor bg_color = GetWidget()->GetThemeProvider()-> 1925 SkColor bg_color = GetWidget()->GetThemeProvider()->
1928 GetColor(BrowserThemeProvider::COLOR_TOOLBAR); 1926 GetColor(BrowserThemeProvider::COLOR_TOOLBAR);
1929 1927
1930 bool sidebar_allowed = SidebarManager::IsSidebarAllowed(); 1928 bool sidebar_allowed = SidebarManager::IsSidebarAllowed();
1931 if (sidebar_allowed) { 1929 if (sidebar_allowed) {
1932 sidebar_container_ = new TabContentsContainer; 1930 sidebar_container_ = new TabContentsContainer;
1933 sidebar_container_->set_reserved_area_delegate(this); 1931 sidebar_container_->set_reserved_area_delegate(this);
1934 sidebar_container_->SetID(VIEW_ID_SIDE_BAR_CONTAINER); 1932 sidebar_container_->SetID(VIEW_ID_SIDE_BAR_CONTAINER);
1935 sidebar_container_->SetVisible(false); 1933 sidebar_container_->SetVisible(false);
1936 1934
1937 sidebar_split_ = new views::SingleSplitView( 1935 sidebar_split_ = new views::SingleSplitView(
1938 contents_, 1936 contents_,
1939 sidebar_container_, 1937 sidebar_container_,
1940 views::SingleSplitView::HORIZONTAL_SPLIT); 1938 views::SingleSplitView::HORIZONTAL_SPLIT);
1941 sidebar_split_->SetID(VIEW_ID_SIDE_BAR_SPLIT); 1939 sidebar_split_->SetID(VIEW_ID_SIDE_BAR_SPLIT);
1942 sidebar_split_->SetAccessibleName( 1940 sidebar_split_->SetAccessibleName(
1943 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_SIDE_BAR))); 1941 l10n_util::GetStringUTF16(IDS_ACCNAME_SIDE_BAR));
1944 sidebar_split_->set_background( 1942 sidebar_split_->set_background(
1945 views::Background::CreateSolidBackground(bg_color)); 1943 views::Background::CreateSolidBackground(bg_color));
1946 } 1944 }
1947 1945
1948 devtools_container_ = new TabContentsContainer; 1946 devtools_container_ = new TabContentsContainer;
1949 devtools_container_->set_reserved_area_delegate(this); 1947 devtools_container_->set_reserved_area_delegate(this);
1950 devtools_container_->SetID(VIEW_ID_DEV_TOOLS_DOCKED); 1948 devtools_container_->SetID(VIEW_ID_DEV_TOOLS_DOCKED);
1951 devtools_container_->SetVisible(false); 1949 devtools_container_->SetVisible(false);
1952 1950
1953 views::View* contents_view = contents_; 1951 views::View* contents_view = contents_;
1954 if (sidebar_allowed) 1952 if (sidebar_allowed)
1955 contents_view = sidebar_split_; 1953 contents_view = sidebar_split_;
1956 1954
1957 contents_split_ = new views::SingleSplitView( 1955 contents_split_ = new views::SingleSplitView(
1958 contents_view, 1956 contents_view,
1959 devtools_container_, 1957 devtools_container_,
1960 views::SingleSplitView::VERTICAL_SPLIT); 1958 views::SingleSplitView::VERTICAL_SPLIT);
1961 contents_split_->SetID(VIEW_ID_CONTENTS_SPLIT); 1959 contents_split_->SetID(VIEW_ID_CONTENTS_SPLIT);
1962 contents_split_->SetAccessibleName( 1960 contents_split_->SetAccessibleName(
1963 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_WEB_CONTENTS))); 1961 l10n_util::GetStringUTF16(IDS_ACCNAME_WEB_CONTENTS));
1964 contents_split_->set_background( 1962 contents_split_->set_background(
1965 views::Background::CreateSolidBackground(bg_color)); 1963 views::Background::CreateSolidBackground(bg_color));
1966 AddChildView(contents_split_); 1964 AddChildView(contents_split_);
1967 set_contents_view(contents_split_); 1965 set_contents_view(contents_split_);
1968 1966
1969 status_bubble_.reset(new StatusBubbleViews(contents_)); 1967 status_bubble_.reset(new StatusBubbleViews(contents_));
1970 1968
1971 #if defined(OS_WIN) 1969 #if defined(OS_WIN)
1972 InitSystemMenu(); 1970 InitSystemMenu();
1973 1971
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 browser_.get())); 2030 browser_.get()));
2033 bookmark_bar_view_->set_parent_owned(false); 2031 bookmark_bar_view_->set_parent_owned(false);
2034 bookmark_bar_view_->set_background( 2032 bookmark_bar_view_->set_background(
2035 new BookmarkExtensionBackground(this, bookmark_bar_view_.get(), 2033 new BookmarkExtensionBackground(this, bookmark_bar_view_.get(),
2036 browser_.get())); 2034 browser_.get()));
2037 } else { 2035 } else {
2038 bookmark_bar_view_->SetProfile(contents->profile()); 2036 bookmark_bar_view_->SetProfile(contents->profile());
2039 } 2037 }
2040 bookmark_bar_view_->SetPageNavigator(contents->tab_contents()); 2038 bookmark_bar_view_->SetPageNavigator(contents->tab_contents());
2041 bookmark_bar_view_->SetAccessibleName( 2039 bookmark_bar_view_->SetAccessibleName(
2042 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS))); 2040 l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS));
2043 new_bookmark_bar_view = bookmark_bar_view_.get(); 2041 new_bookmark_bar_view = bookmark_bar_view_.get();
2044 } 2042 }
2045 return UpdateChildViewAndLayout(new_bookmark_bar_view, &active_bookmark_bar_); 2043 return UpdateChildViewAndLayout(new_bookmark_bar_view, &active_bookmark_bar_);
2046 } 2044 }
2047 2045
2048 bool BrowserView::MaybeShowInfoBar(TabContentsWrapper* contents) { 2046 bool BrowserView::MaybeShowInfoBar(TabContentsWrapper* contents) {
2049 // TODO(beng): Remove this function once the interface between 2047 // TODO(beng): Remove this function once the interface between
2050 // InfoBarContainer, DownloadShelfView and TabContents and this 2048 // InfoBarContainer, DownloadShelfView and TabContents and this
2051 // view is sorted out. 2049 // view is sorted out.
2052 return true; 2050 return true;
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
2568 2566
2569 #if !defined(OS_CHROMEOS) 2567 #if !defined(OS_CHROMEOS)
2570 // static 2568 // static
2571 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { 2569 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
2572 // Create the view and the frame. The frame will attach itself via the view 2570 // Create the view and the frame. The frame will attach itself via the view
2573 // so we don't need to do anything with the pointer. 2571 // so we don't need to do anything with the pointer.
2574 BrowserView* view = new BrowserView(browser); 2572 BrowserView* view = new BrowserView(browser);
2575 BrowserFrame::Create(view, browser->profile()); 2573 BrowserFrame::Create(view, browser->profile());
2576 2574
2577 view->GetWindow()->GetNonClientView()->SetAccessibleName( 2575 view->GetWindow()->GetNonClientView()->SetAccessibleName(
2578 UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); 2576 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
2579 2577
2580 return view; 2578 return view;
2581 } 2579 }
2582 #endif 2580 #endif
2583 2581
2584 // static 2582 // static
2585 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { 2583 FindBar* BrowserWindow::CreateFindBar(Browser* browser) {
2586 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); 2584 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window()));
2587 } 2585 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698