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

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

Issue 1073005: Move RTL related functions from app/l10n_util to base/i18n/rtl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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
« no previous file with comments | « chrome/browser/views/edit_search_engine_dialog.cc ('k') | chrome/browser/views/go_button.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/views/frame/browser_view.h" 5 #include "chrome/browser/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
11 #include "app/drag_drop_types.h" 11 #include "app/drag_drop_types.h"
12 #include "app/gfx/canvas.h" 12 #include "app/gfx/canvas.h"
13 #include "app/l10n_util.h" 13 #include "app/l10n_util.h"
14 #include "app/os_exchange_data.h" 14 #include "app/os_exchange_data.h"
15 #include "app/resource_bundle.h" 15 #include "app/resource_bundle.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/i18n/rtl.h"
17 #include "base/keyboard_codes.h" 18 #include "base/keyboard_codes.h"
18 #include "base/time.h" 19 #include "base/time.h"
19 #include "build/build_config.h" 20 #include "build/build_config.h"
20 #include "chrome/app/chrome_dll_resource.h" 21 #include "chrome/app/chrome_dll_resource.h"
21 #include "chrome/browser/app_modal_dialog_queue.h" 22 #include "chrome/browser/app_modal_dialog_queue.h"
22 #include "chrome/browser/automation/ui_controls.h" 23 #include "chrome/browser/automation/ui_controls.h"
23 #include "chrome/browser/bookmarks/bookmark_utils.h" 24 #include "chrome/browser/bookmarks/bookmark_utils.h"
24 #include "chrome/browser/browser.h" 25 #include "chrome/browser/browser.h"
25 #include "chrome/browser/browser_list.h" 26 #include "chrome/browser/browser_list.h"
26 #include "chrome/browser/browser_process.h" 27 #include "chrome/browser/browser_process.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 ResizeCorner() { } 205 ResizeCorner() { }
205 206
206 virtual void Paint(gfx::Canvas* canvas) { 207 virtual void Paint(gfx::Canvas* canvas) {
207 views::Window* window = GetWindow(); 208 views::Window* window = GetWindow();
208 if (!window || (window->IsMaximized() || window->IsFullscreen())) 209 if (!window || (window->IsMaximized() || window->IsFullscreen()))
209 return; 210 return;
210 211
211 SkBitmap* bitmap = ResourceBundle::GetSharedInstance().GetBitmapNamed( 212 SkBitmap* bitmap = ResourceBundle::GetSharedInstance().GetBitmapNamed(
212 IDR_TEXTAREA_RESIZER); 213 IDR_TEXTAREA_RESIZER);
213 bitmap->buildMipMap(false); 214 bitmap->buildMipMap(false);
214 bool rtl_dir = (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT); 215 bool rtl_dir = base::i18n::IsRTL();
215 if (rtl_dir) { 216 if (rtl_dir) {
216 canvas->TranslateInt(width(), 0); 217 canvas->TranslateInt(width(), 0);
217 canvas->ScaleInt(-1, 1); 218 canvas->ScaleInt(-1, 1);
218 canvas->save(); 219 canvas->save();
219 } 220 }
220 canvas->DrawBitmapInt(*bitmap, width() - bitmap->width(), 221 canvas->DrawBitmapInt(*bitmap, width() - bitmap->width(),
221 height() - bitmap->height()); 222 height() - bitmap->height());
222 if (rtl_dir) 223 if (rtl_dir)
223 canvas->restore(); 224 canvas->restore();
224 } 225 }
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 // shelf, so we don't want others to do it for us in this case. 924 // shelf, so we don't want others to do it for us in this case.
924 // Currently, the only visible bottom shelf is the download shelf. 925 // Currently, the only visible bottom shelf is the download shelf.
925 // Other tests should be added here if we add more bottom shelves. 926 // Other tests should be added here if we add more bottom shelves.
926 if (download_shelf_.get() && download_shelf_->IsShowing()) { 927 if (download_shelf_.get() && download_shelf_->IsShowing()) {
927 return gfx::Rect(); 928 return gfx::Rect();
928 } 929 }
929 930
930 gfx::Rect client_rect = contents_split_->bounds(); 931 gfx::Rect client_rect = contents_split_->bounds();
931 gfx::Size resize_corner_size = ResizeCorner::GetSize(); 932 gfx::Size resize_corner_size = ResizeCorner::GetSize();
932 int x = client_rect.width() - resize_corner_size.width(); 933 int x = client_rect.width() - resize_corner_size.width();
933 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) 934 if (base::i18n::IsRTL())
934 x = 0; 935 x = 0;
935 return gfx::Rect(x, client_rect.height() - resize_corner_size.height(), 936 return gfx::Rect(x, client_rect.height() - resize_corner_size.height(),
936 resize_corner_size.width(), resize_corner_size.height()); 937 resize_corner_size.width(), resize_corner_size.height());
937 } 938 }
938 939
939 void BrowserView::DisableInactiveFrame() { 940 void BrowserView::DisableInactiveFrame() {
940 #if defined(OS_WIN) 941 #if defined(OS_WIN)
941 frame_->GetWindow()->DisableInactiveRendering(); 942 frame_->GetWindow()->DisableInactiveRendering();
942 #endif // No tricks are needed to get the right behavior on Linux. 943 #endif // No tricks are needed to get the right behavior on Linux.
943 } 944 }
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 // independent of layout and also depends on the ResizeCorner which 1542 // independent of layout and also depends on the ResizeCorner which
1542 // is private. 1543 // is private.
1543 if (!frame_->GetWindow()->IsMaximized() && 1544 if (!frame_->GetWindow()->IsMaximized() &&
1544 !frame_->GetWindow()->IsFullscreen()) { 1545 !frame_->GetWindow()->IsFullscreen()) {
1545 CRect client_rect; 1546 CRect client_rect;
1546 ::GetClientRect(frame_->GetWindow()->GetNativeWindow(), &client_rect); 1547 ::GetClientRect(frame_->GetWindow()->GetNativeWindow(), &client_rect);
1547 gfx::Size resize_corner_size = ResizeCorner::GetSize(); 1548 gfx::Size resize_corner_size = ResizeCorner::GetSize();
1548 gfx::Rect resize_corner_rect(client_rect.right - resize_corner_size.width(), 1549 gfx::Rect resize_corner_rect(client_rect.right - resize_corner_size.width(),
1549 client_rect.bottom - resize_corner_size.height(), 1550 client_rect.bottom - resize_corner_size.height(),
1550 resize_corner_size.width(), resize_corner_size.height()); 1551 resize_corner_size.width(), resize_corner_size.height());
1551 bool rtl_dir = (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT); 1552 bool rtl_dir = base::i18n::IsRTL();
1552 if (rtl_dir) 1553 if (rtl_dir)
1553 resize_corner_rect.set_x(0); 1554 resize_corner_rect.set_x(0);
1554 if (resize_corner_rect.Contains(point)) { 1555 if (resize_corner_rect.Contains(point)) {
1555 if (rtl_dir) 1556 if (rtl_dir)
1556 return HTBOTTOMLEFT; 1557 return HTBOTTOMLEFT;
1557 return HTBOTTOMRIGHT; 1558 return HTBOTTOMRIGHT;
1558 } 1559 }
1559 } 1560 }
1560 #endif 1561 #endif
1561 1562
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
2167 SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME)); 2168 SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME));
2168 2169
2169 return view; 2170 return view;
2170 } 2171 }
2171 #endif 2172 #endif
2172 2173
2173 // static 2174 // static
2174 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { 2175 FindBar* BrowserWindow::CreateFindBar(Browser* browser) {
2175 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); 2176 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window()));
2176 } 2177 }
OLDNEW
« no previous file with comments | « chrome/browser/views/edit_search_engine_dialog.cc ('k') | chrome/browser/views/go_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698