summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/autocomplete/autocomplete.cc2
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_win.cc2
-rw-r--r--chrome/browser/autocomplete/history_url_provider.cc2
-rw-r--r--chrome/browser/browser.vcproj12
-rw-r--r--chrome/browser/debugger/debugger_view.cc2
-rw-r--r--chrome/browser/download/download_util.cc2
-rw-r--r--chrome/browser/drag_utils.cc161
-rw-r--r--chrome/browser/drag_utils.h45
-rw-r--r--chrome/browser/gtk/bookmark_bar_gtk.cc2
-rw-r--r--chrome/browser/gtk/download_item_gtk.cc2
-rw-r--r--chrome/browser/input_window_dialog_win.cc2
-rw-r--r--chrome/browser/jsmessage_box_handler.cc2
-rw-r--r--chrome/browser/net/url_fixer_upper.cc6
-rw-r--r--chrome/browser/printing/page_overlays.cc2
-rw-r--r--chrome/browser/printing/printed_document.cc2
-rw-r--r--chrome/browser/tab_contents/navigation_entry.cc2
-rw-r--r--chrome/browser/task_manager.cc2
-rw-r--r--chrome/browser/toolbar_model.cc2
-rw-r--r--chrome/browser/views/about_chrome_view.cc4
-rw-r--r--chrome/browser/views/about_ipc_dialog.cc2
-rw-r--r--chrome/browser/views/about_network_dialog.cc2
-rw-r--r--chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc2
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc4
-rw-r--r--chrome/browser/views/bookmark_bubble_view.cc2
-rw-r--r--chrome/browser/views/bookmark_editor_view.cc2
-rw-r--r--chrome/browser/views/bookmark_manager_view.cc4
-rw-r--r--chrome/browser/views/browser_views.vcproj4
-rw-r--r--chrome/browser/views/bug_report_view.cc2
-rw-r--r--chrome/browser/views/clear_browsing_data.cc2
-rw-r--r--chrome/browser/views/constrained_window_impl.cc2
-rw-r--r--chrome/browser/views/download_item_view.cc2
-rw-r--r--chrome/browser/views/edit_keyword_controller.cc2
-rw-r--r--chrome/browser/views/first_run_bubble.cc2
-rw-r--r--chrome/browser/views/first_run_customize_view.cc2
-rw-r--r--chrome/browser/views/first_run_view.cc2
-rw-r--r--chrome/browser/views/first_run_view_base.cc2
-rw-r--r--chrome/browser/views/hung_renderer_view.cc2
-rw-r--r--chrome/browser/views/importer_lock_view.cc2
-rw-r--r--chrome/browser/views/importer_view.cc2
-rw-r--r--chrome/browser/views/importing_progress_view.cc2
-rw-r--r--chrome/browser/views/keyword_editor_view.cc2
-rw-r--r--chrome/browser/views/login_view.cc2
-rw-r--r--chrome/browser/views/options/advanced_contents_view.cc2
-rw-r--r--chrome/browser/views/options/advanced_page_view.cc2
-rw-r--r--chrome/browser/views/options/content_page_view.cc2
-rw-r--r--chrome/browser/views/options/cookies_view.cc4
-rw-r--r--chrome/browser/views/options/exceptions_page_view.cc2
-rw-r--r--chrome/browser/views/options/fonts_page_view.cc2
-rw-r--r--chrome/browser/views/options/general_page_view.cc2
-rw-r--r--chrome/browser/views/options/languages_page_view.cc2
-rw-r--r--chrome/browser/views/options/options_group_view.cc2
-rw-r--r--chrome/browser/views/options/passwords_page_view.cc2
-rw-r--r--chrome/browser/views/options/passwords_page_view.h2
-rw-r--r--chrome/browser/views/page_info_window.cc2
-rw-r--r--chrome/browser/views/select_profile_dialog.cc2
-rw-r--r--chrome/browser/views/shelf_item_dialog.cc4
-rw-r--r--chrome/browser/views/standard_layout.h77
-rw-r--r--chrome/browser/views/status_bubble_views.cc2
-rw-r--r--chrome/browser/views/toolbar_view.cc5
-rw-r--r--chrome/chrome.gyp14
-rw-r--r--chrome/common/accessibility_types.h48
-rw-r--r--chrome/common/common.vcproj20
-rw-r--r--chrome/common/gfx/color_utils.cc268
-rw-r--r--chrome/common/gfx/color_utils.h63
-rw-r--r--chrome/common/gfx/text_elider.cc517
-rw-r--r--chrome/common/gfx/text_elider.h99
-rw-r--r--chrome/common/gfx/text_elider_unittest.cc267
-rw-r--r--chrome/renderer/render_view.cc2
-rw-r--r--chrome/test/unit/unittests.vcproj8
69 files changed, 75 insertions, 1655 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc
index decdd78..4b9db4e 100644
--- a/chrome/browser/autocomplete/autocomplete.cc
+++ b/chrome/browser/autocomplete/autocomplete.cc
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "app/gfx/text_elider.h"
#include "app/l10n_util.h"
#include "base/basictypes.h"
#include "base/string_util.h"
@@ -18,7 +19,6 @@
#include "chrome/browser/external_protocol_handler.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/profile.h"
-#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
index 8bf5b83..7a2ce8b 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
@@ -26,7 +26,6 @@
#include "chrome/browser/autocomplete/keyword_provider.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/command_updater.h"
-#include "chrome/browser/drag_utils.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/profile.h"
@@ -40,6 +39,7 @@
#include "googleurl/src/url_util.h"
#include "grit/generated_resources.h"
#include "skia/ext/skia_utils_win.h"
+#include "views/drag_utils.h"
#include "views/focus/focus_util_win.h"
#pragma comment(lib, "oleacc.lib") // Needed for accessibility support.
diff --git a/chrome/browser/autocomplete/history_url_provider.cc b/chrome/browser/autocomplete/history_url_provider.cc
index e1b71a9..d623748 100644
--- a/chrome/browser/autocomplete/history_url_provider.cc
+++ b/chrome/browser/autocomplete/history_url_provider.cc
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "app/gfx/text_elider.h"
#include "base/basictypes.h"
#include "base/histogram.h"
#include "base/message_loop.h"
@@ -15,7 +16,6 @@
#include "chrome/browser/history/history_database.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/profile.h"
-#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/sqlite_utils.h"
diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj
index 0dfa68d..91e7a36 100644
--- a/chrome/browser/browser.vcproj
+++ b/chrome/browser/browser.vcproj
@@ -1291,18 +1291,6 @@
</File>
</Filter>
<Filter
- Name="Drag &amp; Drop"
- >
- <File
- RelativePath=".\drag_utils.cc"
- >
- </File>
- <File
- RelativePath=".\drag_utils.h"
- >
- </File>
- </Filter>
- <Filter
Name="Tabs"
>
<File
diff --git a/chrome/browser/debugger/debugger_view.cc b/chrome/browser/debugger/debugger_view.cc
index 865635f..fbb1237 100644
--- a/chrome/browser/debugger/debugger_view.cc
+++ b/chrome/browser/debugger/debugger_view.cc
@@ -19,7 +19,6 @@
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/view_ids.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/browser/views/tab_contents_container_view.h"
#include "chrome/common/url_constants.h"
#include "grit/debugger_resources.h"
@@ -27,6 +26,7 @@
#include "views/controls/scrollbar/native_scroll_bar.h"
#include "views/controls/scroll_view.h"
#include "views/controls/text_field.h"
+#include "views/standard_layout.h"
#include "views/view.h"
DebuggerView::DebuggerView(DebuggerWindow* window)
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
index 74a5d85..6fefb6e 100644
--- a/chrome/browser/download/download_util.cc
+++ b/chrome/browser/download/download_util.cc
@@ -19,13 +19,13 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/download/download_manager.h"
-#include "chrome/browser/drag_utils.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "grit/theme_resources.h"
#include "skia/ext/image_operations.h"
#include "skia/include/SkPath.h"
#include "skia/include/SkShader.h"
+#include "views/drag_utils.h"
#include "views/view.h"
namespace download_util {
diff --git a/chrome/browser/drag_utils.cc b/chrome/browser/drag_utils.cc
deleted file mode 100644
index e40e1d0..0000000
--- a/chrome/browser/drag_utils.cc
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/drag_utils.h"
-
-#include <objidl.h>
-#include <shlobj.h>
-#include <shobjidl.h>
-
-#include "app/gfx/chrome_canvas.h"
-#include "app/gfx/chrome_font.h"
-#include "app/l10n_util.h"
-#include "app/os_exchange_data.h"
-#include "app/resource_bundle.h"
-#include "base/file_util.h"
-#include "base/gfx/gdi_util.h"
-#include "base/gfx/point.h"
-#include "base/string_util.h"
-#include "chrome/browser/views/bookmark_bar_view.h"
-#include "chrome/common/win_util.h"
-#include "googleurl/src/gurl.h"
-#include "grit/theme_resources.h"
-#include "views/controls/button/text_button.h"
-
-namespace drag_utils {
-
-// Maximum width of the link drag image in pixels.
-static const int kLinkDragImageMaxWidth = 200;
-static const int kLinkDragImageVPadding = 3;
-static const int kLinkDragImageVSpacing = 2;
-static const int kLinkDragImageHPadding = 4;
-static const SkColor kLinkDragImageBGColor = SkColorSetRGB(131, 146, 171);
-//static const SkColor kLinkDragImageBGColor = SkColorSetRGB(195, 217, 255);
-static const SkColor kLinkDragImageTextColor = SK_ColorBLACK;
-
-// File dragging pixel measurements
-static const int kFileDragImageMaxWidth = 200;
-static const SkColor kFileDragImageTextColor = SK_ColorBLACK;
-
-static void SetDragImageOnDataObject(HBITMAP hbitmap,
- int width,
- int height,
- int cursor_offset_x,
- int cursor_offset_y,
- IDataObject* data_object) {
- IDragSourceHelper* helper = NULL;
- HRESULT rv = CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER,
- IID_IDragSourceHelper, reinterpret_cast<LPVOID*>(&helper));
- if (SUCCEEDED(rv)) {
- SHDRAGIMAGE sdi;
- sdi.sizeDragImage.cx = width;
- sdi.sizeDragImage.cy = height;
- sdi.crColorKey = 0xFFFFFFFF;
- sdi.hbmpDragImage = hbitmap;
- sdi.ptOffset.x = cursor_offset_x;
- sdi.ptOffset.y = cursor_offset_y;
- helper->InitializeFromBitmap(&sdi, data_object);
- }
-};
-
-// Blit the contents of the canvas to a new HBITMAP. It is the caller's
-// responsibility to release the |bits| buffer.
-static HBITMAP CreateBitmapFromCanvas(const ChromeCanvas& canvas,
- int width,
- int height) {
- HDC screen_dc = GetDC(NULL);
- BITMAPINFOHEADER header;
- gfx::CreateBitmapHeader(width, height, &header);
- void* bits;
- HBITMAP bitmap =
- CreateDIBSection(screen_dc, reinterpret_cast<BITMAPINFO*>(&header),
- DIB_RGB_COLORS, &bits, NULL, 0);
- HDC compatible_dc = CreateCompatibleDC(screen_dc);
- HGDIOBJ old_object = SelectObject(compatible_dc, bitmap);
- BitBlt(compatible_dc, 0, 0, width, height,
- canvas.getTopPlatformDevice().getBitmapDC(),
- 0, 0, SRCCOPY);
- SelectObject(compatible_dc, old_object);
- ReleaseDC(NULL, compatible_dc);
- ReleaseDC(NULL, screen_dc);
- return bitmap;
-}
-
-void SetURLAndDragImage(const GURL& url,
- const std::wstring& title,
- const SkBitmap& icon,
- OSExchangeData* data) {
- DCHECK(url.is_valid() && data);
-
- data->SetURL(url, title);
-
- // Create a button to render the drag image for us.
- views::TextButton button(NULL,
- title.empty() ? UTF8ToWide(url.spec()) : title);
- button.set_max_width(BookmarkBarView::kMaxButtonWidth);
- if (icon.isNull()) {
- button.SetIcon(*ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_DEFAULT_FAVICON));
- } else {
- button.SetIcon(icon);
- }
- gfx::Size prefsize = button.GetPreferredSize();
- button.SetBounds(0, 0, prefsize.width(), prefsize.height());
-
- // Render the image.
- ChromeCanvas canvas(prefsize.width(), prefsize.height(), false);
- button.Paint(&canvas, true);
- SetDragImageOnDataObject(canvas, prefsize.width(), prefsize.height(),
- prefsize.width() / 2, prefsize.height() / 2,
- data);
-}
-
-void CreateDragImageForFile(const std::wstring& file_name,
- SkBitmap* icon,
- IDataObject* data_object) {
- DCHECK(icon);
- DCHECK(data_object);
-
- // Set up our text portion
- const std::wstring& name = file_util::GetFilenameFromPath(file_name);
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- ChromeFont font = rb.GetFont(ResourceBundle::BaseFont);
-
- const int width = kFileDragImageMaxWidth;
- // Add +2 here to allow room for the halo.
- const int height = font.height() + icon->height() +
- kLinkDragImageVPadding + 2;
- ChromeCanvas canvas(width, height, false /* translucent */);
-
- // Paint the icon.
- canvas.DrawBitmapInt(*icon, (width - icon->width()) / 2, 0);
-
- // Paint the file name. We inset it one pixel to allow room for the halo.
- canvas.DrawStringWithHalo(name, font, kFileDragImageTextColor, SK_ColorWHITE,
- 1, icon->height() + kLinkDragImageVPadding + 1,
- width - 2, font.height(),
- ChromeCanvas::TEXT_ALIGN_CENTER);
-
- SetDragImageOnDataObject(canvas, width, height, width / 2,
- kLinkDragImageVPadding, data_object);
-}
-
-void SetDragImageOnDataObject(const ChromeCanvas& canvas,
- int width,
- int height,
- int cursor_x_offset,
- int cursor_y_offset,
- IDataObject* data_object) {
- DCHECK(data_object && width > 0 && height > 0);
- // SetDragImageOnDataObject(HBITMAP) takes ownership of the bitmap.
- HBITMAP bitmap = CreateBitmapFromCanvas(canvas, width, height);
-
- // Attach 'bitmap' to the data_object.
- SetDragImageOnDataObject(bitmap, width, height,
- cursor_x_offset,
- cursor_y_offset,
- data_object);
-}
-
-} // namespace drag_utils
diff --git a/chrome/browser/drag_utils.h b/chrome/browser/drag_utils.h
deleted file mode 100644
index a1f4b70..0000000
--- a/chrome/browser/drag_utils.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_DRAG_UTILS_H__
-#define CHROME_BROWSER_DRAG_UTILS_H__
-
-#include <objidl.h>
-#include <string>
-
-class ChromeCanvas;
-class GURL;
-class OSExchangeData;
-class SkBitmap;
-
-namespace drag_utils {
-
-// Sets url and title on data as well as setting a suitable image for dragging.
-// The image looks like that of the bookmark buttons.
-void SetURLAndDragImage(const GURL& url,
- const std::wstring& title,
- const SkBitmap& icon,
- OSExchangeData* data);
-
-// Creates a dragging image to be displayed when the user drags a file from
-// Chrome (via the download manager, for example). The drag image is set into
-// the supplied data_object. 'file_name' can be a full path, but the directory
-// portion will be truncated in the drag image.
-void CreateDragImageForFile(const std::wstring& file_name,
- SkBitmap* icon,
- IDataObject* data_object);
-
-// Sets the drag image on data_object from the supplied canvas. width/height
-// are the size of the image to use, and the offsets give the location of
-// the hotspot for the drag image.
-void SetDragImageOnDataObject(const ChromeCanvas& canvas,
- int width,
- int height,
- int cursor_x_offset,
- int cursor_y_offset,
- IDataObject* data_object);
-
-} // namespace drag_utils
-
-#endif // #ifndef CHROME_BROWSER_DRAG_UTILS_H__
diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/gtk/bookmark_bar_gtk.cc
index ada9183..ebfe567 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk.cc
+++ b/chrome/browser/gtk/bookmark_bar_gtk.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/gtk/bookmark_bar_gtk.h"
+#include "app/gfx/text_elider.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/gfx/gtk_util.h"
@@ -15,7 +16,6 @@
#include "chrome/browser/gtk/gtk_chrome_button.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/profile.h"
-#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
diff --git a/chrome/browser/gtk/download_item_gtk.cc b/chrome/browser/gtk/download_item_gtk.cc
index 4a89aa8..42699e4 100644
--- a/chrome/browser/gtk/download_item_gtk.cc
+++ b/chrome/browser/gtk/download_item_gtk.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/gtk/download_item_gtk.h"
#include "app/gfx/chrome_font.h"
+#include "app/gfx/text_elider.h"
#include "app/slide_animation.h"
#include "base/basictypes.h"
#include "base/string_util.h"
@@ -14,7 +15,6 @@
#include "chrome/browser/gtk/download_shelf_gtk.h"
#include "chrome/browser/gtk/menu_gtk.h"
#include "chrome/browser/gtk/nine_box.h"
-#include "chrome/common/gfx/text_elider.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/input_window_dialog_win.cc b/chrome/browser/input_window_dialog_win.cc
index 73f10a3..d236cc9 100644
--- a/chrome/browser/input_window_dialog_win.cc
+++ b/chrome/browser/input_window_dialog_win.cc
@@ -7,10 +7,10 @@
#include "app/l10n_util.h"
#include "base/message_loop.h"
#include "base/task.h"
-#include "chrome/browser/views/standard_layout.h"
#include "views/grid_layout.h"
#include "views/controls/label.h"
#include "views/controls/text_field.h"
+#include "views/standard_layout.h"
#include "views/window/dialog_delegate.h"
#include "views/window/window.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/jsmessage_box_handler.cc b/chrome/browser/jsmessage_box_handler.cc
index 061e469..7de44e8 100644
--- a/chrome/browser/jsmessage_box_handler.cc
+++ b/chrome/browser/jsmessage_box_handler.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/jsmessage_box_handler.h"
+#include "app/gfx/text_elider.h"
#include "app/l10n_util.h"
#include "app/message_box_flags.h"
#include "build/build_config.h"
@@ -11,7 +12,6 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "googleurl/src/gurl.h"
diff --git a/chrome/browser/net/url_fixer_upper.cc b/chrome/browser/net/url_fixer_upper.cc
index edccfa0..4162061 100644
--- a/chrome/browser/net/url_fixer_upper.cc
+++ b/chrome/browser/net/url_fixer_upper.cc
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <algorithm>
-
#include "chrome/browser/net/url_fixer_upper.h"
+#include <algorithm>
+
+#include "app/gfx/text_elider.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/string_util.h"
-#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/url_constants.h"
#include "googleurl/src/gurl.h"
#include "googleurl/src/url_file.h"
diff --git a/chrome/browser/printing/page_overlays.cc b/chrome/browser/printing/page_overlays.cc
index 4a20dd6..6233d84 100644
--- a/chrome/browser/printing/page_overlays.cc
+++ b/chrome/browser/printing/page_overlays.cc
@@ -4,11 +4,11 @@
#include "chrome/browser/printing/page_overlays.h"
+#include "app/gfx/text_elider.h"
#include "base/logging.h"
#include "base/string_util.h"
#include "chrome/browser/printing/printed_document.h"
#include "chrome/browser/printing/printed_page.h"
-#include "chrome/common/gfx/text_elider.h"
namespace {
diff --git a/chrome/browser/printing/printed_document.cc b/chrome/browser/printing/printed_document.cc
index 902554b..c408513 100644
--- a/chrome/browser/printing/printed_document.cc
+++ b/chrome/browser/printing/printed_document.cc
@@ -7,6 +7,7 @@
#include <set>
#include "app/gfx/chrome_font.h"
+#include "app/gfx/text_elider.h"
#include "base/message_loop.h"
#include "base/time.h"
#include "chrome/browser/printing/page_number.h"
@@ -14,7 +15,6 @@
#include "chrome/browser/printing/printed_pages_source.h"
#include "chrome/browser/printing/printed_page.h"
#include "chrome/common/gfx/emf.h"
-#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/time_format.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/win_util.h"
diff --git a/chrome/browser/tab_contents/navigation_entry.cc b/chrome/browser/tab_contents/navigation_entry.cc
index 874f9fc..2b6e20f 100644
--- a/chrome/browser/tab_contents/navigation_entry.cc
+++ b/chrome/browser/tab_contents/navigation_entry.cc
@@ -4,9 +4,9 @@
#include "chrome/browser/tab_contents/navigation_entry.h"
+#include "app/gfx/text_elider.h"
#include "app/resource_bundle.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
-#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc
index b48f304..90b0ee8 100644
--- a/chrome/browser/task_manager.cc
+++ b/chrome/browser/task_manager.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/task_manager_resource_providers.h"
#include "chrome/browser/tab_contents/tab_util.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
@@ -28,6 +27,7 @@
#include "views/controls/button/native_button.h"
#include "views/controls/link.h"
#include "views/controls/menu/menu.h"
+#include "views/standard_layout.h"
#include "views/widget/widget.h"
#include "views/window/dialog_delegate.h"
#include "views/window/window.h"
diff --git a/chrome/browser/toolbar_model.cc b/chrome/browser/toolbar_model.cc
index ec6be7c..b091fc8 100644
--- a/chrome/browser/toolbar_model.cc
+++ b/chrome/browser/toolbar_model.cc
@@ -4,13 +4,13 @@
#include "chrome/browser/toolbar_model.h"
+#include "app/gfx/text_elider.h"
#include "app/l10n_util.h"
#include "chrome/browser/cert_store.h"
#include "chrome/browser/ssl/ssl_error_info.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc
index faa8744..cc4e294 100644
--- a/chrome/browser/views/about_chrome_view.cc
+++ b/chrome/browser/views/about_chrome_view.cc
@@ -7,6 +7,7 @@
#include <commdlg.h>
#include "app/gfx/chrome_canvas.h"
+#include "app/gfx/color_utils.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/file_version_info.h"
@@ -14,10 +15,8 @@
#include "base/win_util.h"
#include "base/word_iterator.h"
#include "chrome/browser/browser_list.h"
-#include "chrome/common/gfx/color_utils.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/views/restart_message_box.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/installer/util/install_util.h"
#include "grit/chromium_strings.h"
@@ -26,6 +25,7 @@
#include "grit/theme_resources.h"
#include "views/controls/text_field.h"
#include "views/controls/throbber.h"
+#include "views/standard_layout.h"
#include "views/window/window.h"
#include "webkit/glue/webkit_glue.h"
diff --git a/chrome/browser/views/about_ipc_dialog.cc b/chrome/browser/views/about_ipc_dialog.cc
index 9d11334..27987b1 100644
--- a/chrome/browser/views/about_ipc_dialog.cc
+++ b/chrome/browser/views/about_ipc_dialog.cc
@@ -20,7 +20,6 @@
#include "base/time.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/devtools_messages.h"
#include "chrome/common/plugin_messages.h"
@@ -31,6 +30,7 @@
#include "views/grid_layout.h"
#include "views/controls/button/text_button.h"
#include "views/controls/hwnd_view.h"
+#include "views/standard_layout.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
#include "views/window/window.h"
diff --git a/chrome/browser/views/about_network_dialog.cc b/chrome/browser/views/about_network_dialog.cc
index aced9e3..74235ba 100644
--- a/chrome/browser/views/about_network_dialog.cc
+++ b/chrome/browser/views/about_network_dialog.cc
@@ -7,13 +7,13 @@
#include "base/string_util.h"
#include "base/thread.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/views/standard_layout.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_job.h"
#include "net/url_request/url_request_job_tracker.h"
#include "views/grid_layout.h"
#include "views/controls/button/text_button.h"
#include "views/controls/text_field.h"
+#include "views/standard_layout.h"
#include "views/window/window.h"
namespace {
diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
index a6c9366..2dddc6f 100644
--- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
@@ -7,6 +7,7 @@
#include <dwmapi.h>
#include "app/gfx/chrome_canvas.h"
+#include "app/gfx/color_utils.h"
#include "app/gfx/insets.h"
#include "app/gfx/path.h"
#include "app/l10n_util.h"
@@ -14,7 +15,6 @@
#include "chrome/browser/autocomplete/autocomplete_edit_view_win.h"
#include "chrome/browser/autocomplete/autocomplete_popup_model.h"
#include "chrome/browser/views/autocomplete/autocomplete_popup_win.h"
-#include "chrome/common/gfx/color_utils.h"
#include "chrome/common/win_util.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index d54e5ff..5604db7 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -7,6 +7,7 @@
#include <limits>
#include "app/gfx/chrome_canvas.h"
+#include "app/gfx/text_elider.h"
#include "app/l10n_util.h"
#include "app/os_exchange_data.h"
#include "app/resource_bundle.h"
@@ -15,7 +16,6 @@
#include "chrome/browser/bookmarks/bookmark_context_menu.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/browser.h"
-#include "chrome/browser/drag_utils.h"
#include "chrome/browser/extensions/extension.h"
#include "chrome/browser/extensions/extension_view.h"
#include "chrome/browser/extensions/extensions_service.h"
@@ -27,7 +27,6 @@
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/view_ids.h"
#include "chrome/browser/views/event_utils.h"
-#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/common/pref_names.h"
@@ -38,6 +37,7 @@
#include "skia/ext/skia_utils.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/menu/chrome_menu.h"
+#include "views/drag_utils.h"
#include "views/view_constants.h"
#include "views/widget/tooltip_manager.h"
#include "views/widget/widget.h"
diff --git a/chrome/browser/views/bookmark_bubble_view.cc b/chrome/browser/views/bookmark_bubble_view.cc
index abae95f..e24665c 100644
--- a/chrome/browser/views/bookmark_bubble_view.cc
+++ b/chrome/browser/views/bookmark_bubble_view.cc
@@ -14,10 +14,10 @@
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/views/info_bubble.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/notification_service.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "views/standard_layout.h"
#include "views/controls/button/native_button.h"
#include "views/controls/text_field.h"
diff --git a/chrome/browser/views/bookmark_editor_view.cc b/chrome/browser/views/bookmark_editor_view.cc
index 40472cb..692f72d 100644
--- a/chrome/browser/views/bookmark_editor_view.cc
+++ b/chrome/browser/views/bookmark_editor_view.cc
@@ -12,7 +12,6 @@
#include "chrome/browser/history/history.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/net/url_fixer_upper.h"
-#include "chrome/browser/views/standard_layout.h"
#include "googleurl/src/gurl.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -22,6 +21,7 @@
#include "views/grid_layout.h"
#include "views/controls/button/native_button.h"
#include "views/controls/label.h"
+#include "views/standard_layout.h"
#include "views/widget/widget.h"
#include "views/window/window.h"
diff --git a/chrome/browser/views/bookmark_manager_view.cc b/chrome/browser/views/bookmark_manager_view.cc
index ec28029..41df839 100644
--- a/chrome/browser/views/bookmark_manager_view.cc
+++ b/chrome/browser/views/bookmark_manager_view.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "app/gfx/chrome_canvas.h"
+#include "app/gfx/color_utils.h"
#include "base/thread.h"
#include "chrome/browser/bookmarks/bookmark_folder_tree_model.h"
#include "chrome/browser/bookmarks/bookmark_html_writer.h"
@@ -21,8 +22,6 @@
#include "chrome/browser/views/bookmark_editor_view.h"
#include "chrome/browser/views/bookmark_folder_tree_view.h"
#include "chrome/browser/views/bookmark_table_view.h"
-#include "chrome/browser/views/standard_layout.h"
-#include "chrome/common/gfx/color_utils.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/win_util.h"
@@ -33,6 +32,7 @@
#include "views/controls/button/menu_button.h"
#include "views/controls/label.h"
#include "views/controls/single_split_view.h"
+#include "views/standard_layout.h"
#include "views/widget/widget.h"
#include "views/window/window.h"
diff --git a/chrome/browser/views/browser_views.vcproj b/chrome/browser/views/browser_views.vcproj
index 1fc5c21..3a79320 100644
--- a/chrome/browser/views/browser_views.vcproj
+++ b/chrome/browser/views/browser_views.vcproj
@@ -786,10 +786,6 @@
>
</File>
<File
- RelativePath=".\standard_layout.h"
- >
- </File>
- <File
RelativePath=".\star_toggle.cc"
>
</File>
diff --git a/chrome/browser/views/bug_report_view.cc b/chrome/browser/views/bug_report_view.cc
index 7bebdc5..3af66f4 100644
--- a/chrome/browser/views/bug_report_view.cc
+++ b/chrome/browser/views/bug_report_view.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
@@ -26,6 +25,7 @@
#include "views/controls/button/checkbox.h"
#include "views/controls/label.h"
#include "views/grid_layout.h"
+#include "views/standard_layout.h"
#include "views/window/client_view.h"
#include "views/window/window.h"
diff --git a/chrome/browser/views/clear_browsing_data.cc b/chrome/browser/views/clear_browsing_data.cc
index 6502cd4..1b4f517 100644
--- a/chrome/browser/views/clear_browsing_data.cc
+++ b/chrome/browser/views/clear_browsing_data.cc
@@ -7,7 +7,6 @@
#include "app/l10n_util.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url_model.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
@@ -17,6 +16,7 @@
#include "views/controls/button/checkbox.h"
#include "views/controls/label.h"
#include "views/controls/throbber.h"
+#include "views/standard_layout.h"
#include "views/window/window.h"
using base::Time;
diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc
index 142a983..ca4f35c 100644
--- a/chrome/browser/views/constrained_window_impl.cc
+++ b/chrome/browser/views/constrained_window_impl.cc
@@ -7,6 +7,7 @@
#include "app/gfx/chrome_canvas.h"
#include "app/gfx/chrome_font.h"
#include "app/gfx/path.h"
+#include "app/gfx/text_elider.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/gfx/rect.h"
@@ -20,7 +21,6 @@
#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/window_sizer.h"
#include "chrome/common/chrome_constants.h"
-#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc
index 4f1d349..aa74f2fa1 100644
--- a/chrome/browser/views/download_item_view.cc
+++ b/chrome/browser/views/download_item_view.cc
@@ -7,6 +7,7 @@
#include <vector>
#include "app/gfx/chrome_canvas.h"
+#include "app/gfx/text_elider.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/file_path.h"
@@ -15,7 +16,6 @@
#include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/views/download_shelf_view.h"
-#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/win_util.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/views/edit_keyword_controller.cc b/chrome/browser/views/edit_keyword_controller.cc
index c18e94f..2774379 100644
--- a/chrome/browser/views/edit_keyword_controller.cc
+++ b/chrome/browser/views/edit_keyword_controller.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/views/keyword_editor_view.h"
-#include "chrome/browser/views/standard_layout.h"
#include "googleurl/src/gurl.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -21,6 +20,7 @@
#include "views/controls/image_view.h"
#include "views/controls/table/table_view.h"
#include "views/grid_layout.h"
+#include "views/standard_layout.h"
#include "views/window/window.h"
using views::GridLayout;
diff --git a/chrome/browser/views/first_run_bubble.cc b/chrome/browser/views/first_run_bubble.cc
index 61bcdb2..552bb44 100644
--- a/chrome/browser/views/first_run_bubble.cc
+++ b/chrome/browser/views/first_run_bubble.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/options_window.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url_model.h"
-#include "chrome/browser/views/standard_layout.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -21,6 +20,7 @@
#include "views/controls/button/native_button.h"
#include "views/controls/label.h"
#include "views/focus/focus_manager.h"
+#include "views/standard_layout.h"
#include "views/window/window.h"
namespace {
diff --git a/chrome/browser/views/first_run_customize_view.cc b/chrome/browser/views/first_run_customize_view.cc
index 1ac1eb7..7a378ef 100644
--- a/chrome/browser/views/first_run_customize_view.cc
+++ b/chrome/browser/views/first_run_customize_view.cc
@@ -9,7 +9,6 @@
#include "chrome/browser/importer/importer.h"
#include "chrome/browser/first_run.h"
#include "chrome/browser/metrics/user_metrics.h"
-#include "chrome/browser/views/standard_layout.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -19,6 +18,7 @@
#include "views/controls/image_view.h"
#include "views/controls/label.h"
#include "views/controls/throbber.h"
+#include "views/standard_layout.h"
#include "views/window/window.h"
FirstRunCustomizeView::FirstRunCustomizeView(Profile* profile,
diff --git a/chrome/browser/views/first_run_view.cc b/chrome/browser/views/first_run_view.cc
index 866b114..bd172f1 100644
--- a/chrome/browser/views/first_run_view.cc
+++ b/chrome/browser/views/first_run_view.cc
@@ -10,7 +10,6 @@
#include "chrome/browser/first_run.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/views/first_run_customize_view.h"
-#include "chrome/browser/views/standard_layout.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -20,6 +19,7 @@
#include "views/controls/label.h"
#include "views/controls/throbber.h"
#include "views/controls/separator.h"
+#include "views/standard_layout.h"
#include "views/window/window.h"
namespace {
diff --git a/chrome/browser/views/first_run_view_base.cc b/chrome/browser/views/first_run_view_base.cc
index 5a3788a..afb73f0 100644
--- a/chrome/browser/views/first_run_view_base.cc
+++ b/chrome/browser/views/first_run_view_base.cc
@@ -14,7 +14,6 @@
#include "chrome/browser/first_run.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/shell_integration.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
@@ -27,6 +26,7 @@
#include "views/controls/label.h"
#include "views/controls/throbber.h"
#include "views/controls/separator.h"
+#include "views/standard_layout.h"
#include "views/window/client_view.h"
#include "views/window/window.h"
diff --git a/chrome/browser/views/hung_renderer_view.cc b/chrome/browser/views/hung_renderer_view.cc
index ae0ac20..20c7e06 100644
--- a/chrome/browser/views/hung_renderer_view.cc
+++ b/chrome/browser/views/hung_renderer_view.cc
@@ -9,7 +9,6 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/logging_chrome.h"
@@ -22,6 +21,7 @@
#include "views/controls/image_view.h"
#include "views/controls/label.h"
#include "views/controls/table/group_table_view.h"
+#include "views/standard_layout.h"
#include "views/window/client_view.h"
#include "views/window/dialog_delegate.h"
#include "views/window/window.h"
diff --git a/chrome/browser/views/importer_lock_view.cc b/chrome/browser/views/importer_lock_view.cc
index e2fc249..3d58b33 100644
--- a/chrome/browser/views/importer_lock_view.cc
+++ b/chrome/browser/views/importer_lock_view.cc
@@ -6,11 +6,11 @@
#include "app/l10n_util.h"
#include "chrome/browser/importer/importer.h"
-#include "chrome/browser/views/standard_layout.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "views/controls/label.h"
+#include "views/standard_layout.h"
#include "views/window/window.h"
using views::ColumnSet;
diff --git a/chrome/browser/views/importer_view.cc b/chrome/browser/views/importer_view.cc
index 7f03c3b..4bee708 100644
--- a/chrome/browser/views/importer_view.cc
+++ b/chrome/browser/views/importer_view.cc
@@ -6,12 +6,12 @@
#include "app/l10n_util.h"
#include "chrome/browser/browser_list.h"
-#include "chrome/browser/views/standard_layout.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "views/controls/button/checkbox.h"
#include "views/controls/label.h"
#include "views/grid_layout.h"
+#include "views/standard_layout.h"
#include "views/window/window.h"
using views::ColumnSet;
diff --git a/chrome/browser/views/importing_progress_view.cc b/chrome/browser/views/importing_progress_view.cc
index 2c917d2..8ed9bf8 100644
--- a/chrome/browser/views/importing_progress_view.cc
+++ b/chrome/browser/views/importing_progress_view.cc
@@ -5,13 +5,13 @@
#include "chrome/browser/views/importing_progress_view.h"
#include "app/l10n_util.h"
-#include "chrome/browser/views/standard_layout.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "views/grid_layout.h"
#include "views/controls/label.h"
#include "views/controls/throbber.h"
+#include "views/standard_layout.h"
#include "views/window/window.h"
////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/views/keyword_editor_view.cc b/chrome/browser/views/keyword_editor_view.cc
index bfb90dc..4dd4296 100644
--- a/chrome/browser/views/keyword_editor_view.cc
+++ b/chrome/browser/views/keyword_editor_view.cc
@@ -17,7 +17,6 @@
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/views/edit_keyword_controller.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "googleurl/src/gurl.h"
@@ -29,6 +28,7 @@
#include "views/grid_layout.h"
#include "views/controls/button/native_button.h"
#include "views/controls/text_field.h"
+#include "views/standard_layout.h"
#include "views/widget/widget.h"
#include "views/window/dialog_delegate.h"
#include "views/window/window.h"
diff --git a/chrome/browser/views/login_view.cc b/chrome/browser/views/login_view.cc
index 150e447..cab7ba2 100644
--- a/chrome/browser/views/login_view.cc
+++ b/chrome/browser/views/login_view.cc
@@ -8,11 +8,11 @@
#include "app/l10n_util.h"
#include "base/message_loop.h"
-#include "chrome/browser/views/standard_layout.h"
#include "grit/generated_resources.h"
#include "views/grid_layout.h"
#include "views/controls/label.h"
#include "views/controls/text_field.h"
+#include "views/standard_layout.h"
#include "views/widget/root_view.h"
namespace views {
diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc
index aed2aea..3bbf9a6 100644
--- a/chrome/browser/views/options/advanced_contents_view.cc
+++ b/chrome/browser/views/options/advanced_contents_view.cc
@@ -28,7 +28,6 @@
#include "chrome/browser/views/options/cookies_view.h"
#include "chrome/browser/views/options/language_combobox_model.h"
#include "chrome/browser/views/restart_message_box.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/filter_policy.h"
#include "chrome/common/pref_member.h"
#include "chrome/common/pref_names.h"
@@ -43,6 +42,7 @@
#include "views/controls/combo_box.h"
#include "views/controls/scroll_view.h"
#include "views/grid_layout.h"
+#include "views/standard_layout.h"
#include "views/widget/widget.h"
using views::GridLayout;
diff --git a/chrome/browser/views/options/advanced_page_view.cc b/chrome/browser/views/options/advanced_page_view.cc
index ac0fed1..c20ecad 100644
--- a/chrome/browser/views/options/advanced_page_view.cc
+++ b/chrome/browser/views/options/advanced_page_view.cc
@@ -10,7 +10,6 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/views/options/advanced_contents_view.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
@@ -21,6 +20,7 @@
#include "views/controls/button/native_button.h"
#include "views/controls/scroll_view.h"
#include "views/grid_layout.h"
+#include "views/standard_layout.h"
#include "views/window/dialog_delegate.h"
#include "views/window/window.h"
diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc
index 955ea3e..6e3aff2 100644
--- a/chrome/browser/views/options/content_page_view.cc
+++ b/chrome/browser/views/options/content_page_view.cc
@@ -19,7 +19,6 @@
#include "chrome/browser/views/options/fonts_languages_window_view.h"
#include "chrome/browser/views/options/options_group_view.h"
#include "chrome/browser/views/options/passwords_exceptions_window_view.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
@@ -29,6 +28,7 @@
#include "views/controls/button/radio_button.h"
#include "views/controls/text_field.h"
#include "views/grid_layout.h"
+#include "views/standard_layout.h"
#include "views/widget/widget.h"
namespace {
diff --git a/chrome/browser/views/options/cookies_view.cc b/chrome/browser/views/options/cookies_view.cc
index 012e6ab..2b5ab0f 100644
--- a/chrome/browser/views/options/cookies_view.cc
+++ b/chrome/browser/views/options/cookies_view.cc
@@ -7,13 +7,12 @@
#include "chrome/browser/views/options/cookies_view.h"
#include "app/gfx/chrome_canvas.h"
+#include "app/gfx/color_utils.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/string_util.h"
#include "base/time_format.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/views/standard_layout.h"
-#include "chrome/common/gfx/color_utils.h"
#include "chrome/common/win_util.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -26,6 +25,7 @@
#include "views/controls/button/native_button.h"
#include "views/controls/text_field.h"
#include "views/controls/table/table_view.h"
+#include "views/standard_layout.h"
// static
views::Window* CookiesView::instance_ = NULL;
diff --git a/chrome/browser/views/options/exceptions_page_view.cc b/chrome/browser/views/options/exceptions_page_view.cc
index 6492640..daff30e 100644
--- a/chrome/browser/views/options/exceptions_page_view.cc
+++ b/chrome/browser/views/options/exceptions_page_view.cc
@@ -7,13 +7,13 @@
#include "app/l10n_util.h"
#include "base/string_util.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "views/background.h"
#include "views/controls/button/native_button.h"
#include "views/grid_layout.h"
+#include "views/standard_layout.h"
using views::ColumnSet;
using views::GridLayout;
diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/views/options/fonts_page_view.cc
index 7e497c0..d9256ea 100644
--- a/chrome/browser/views/options/fonts_page_view.cc
+++ b/chrome/browser/views/options/fonts_page_view.cc
@@ -21,7 +21,6 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/character_encoding.h"
#include "chrome/browser/shell_dialogs.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
@@ -31,6 +30,7 @@
#include "views/controls/button/native_button.h"
#include "views/controls/text_field.h"
#include "views/grid_layout.h"
+#include "views/standard_layout.h"
#include "views/widget/widget.h"
namespace {
diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc
index 505d85a..2726b83 100644
--- a/chrome/browser/views/options/general_page_view.cc
+++ b/chrome/browser/views/options/general_page_view.cc
@@ -23,7 +23,6 @@
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/views/keyword_editor_view.h"
#include "chrome/browser/views/options/options_group_view.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/browser/dom_ui/new_tab_ui.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
@@ -38,6 +37,7 @@
#include "views/controls/table/table_view.h"
#include "views/controls/text_field.h"
#include "views/grid_layout.h"
+#include "views/standard_layout.h"
namespace {
diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/views/options/languages_page_view.cc
index c3b6a29..06d2ad1 100644
--- a/chrome/browser/views/options/languages_page_view.cc
+++ b/chrome/browser/views/options/languages_page_view.cc
@@ -21,7 +21,6 @@
#include "chrome/browser/spellchecker.h"
#include "chrome/browser/views/options/language_combobox_model.h"
#include "chrome/browser/views/restart_message_box.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
@@ -34,6 +33,7 @@
#include "views/controls/tabbed_pane.h"
#include "views/controls/text_field.h"
#include "views/grid_layout.h"
+#include "views/standard_layout.h"
#include "views/widget/widget.h"
#include "views/window/window.h"
diff --git a/chrome/browser/views/options/options_group_view.cc b/chrome/browser/views/options/options_group_view.cc
index fa7d3cd..91a617f 100644
--- a/chrome/browser/views/options/options_group_view.cc
+++ b/chrome/browser/views/options/options_group_view.cc
@@ -12,12 +12,12 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/gfx/native_theme.h"
-#include "chrome/browser/views/standard_layout.h"
#include "grit/locale_settings.h"
#include "grit/generated_resources.h"
#include "views/grid_layout.h"
#include "views/controls/label.h"
#include "views/controls/separator.h"
+#include "views/standard_layout.h"
static const int kLeftColumnWidthChars = 20;
static const int kOptionsGroupViewColumnSpacing = 30;
diff --git a/chrome/browser/views/options/passwords_page_view.cc b/chrome/browser/views/options/passwords_page_view.cc
index f7f02cd..77c02ad 100644
--- a/chrome/browser/views/options/passwords_page_view.cc
+++ b/chrome/browser/views/options/passwords_page_view.cc
@@ -7,13 +7,13 @@
#include "app/l10n_util.h"
#include "base/string_util.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "views/background.h"
#include "views/controls/button/native_button.h"
#include "views/grid_layout.h"
+#include "views/standard_layout.h"
using views::ColumnSet;
using views::GridLayout;
diff --git a/chrome/browser/views/options/passwords_page_view.h b/chrome/browser/views/options/passwords_page_view.h
index a7a30b5..2fd9e46 100644
--- a/chrome/browser/views/options/passwords_page_view.h
+++ b/chrome/browser/views/options/passwords_page_view.h
@@ -7,11 +7,11 @@
#include <vector>
+#include "app/gfx/text_elider.h"
#include "base/scoped_ptr.h"
#include "base/stl_util-inl.h"
#include "chrome/browser/views/options/options_page_view.h"
#include "chrome/browser/webdata/web_data_service.h"
-#include "chrome/common/gfx/text_elider.h"
#include "views/controls/button/native_button.h"
#include "views/controls/label.h"
#include "views/controls/table/table_view.h"
diff --git a/chrome/browser/views/page_info_window.cc b/chrome/browser/views/page_info_window.cc
index ad37f7b..7f73092 100644
--- a/chrome/browser/views/page_info_window.cc
+++ b/chrome/browser/views/page_info_window.cc
@@ -16,7 +16,6 @@
#include "chrome/browser/history/history.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/ssl/ssl_manager.h"
-#include "chrome/browser/views/standard_layout.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/win_util.h"
@@ -32,6 +31,7 @@
#include "views/controls/image_view.h"
#include "views/controls/label.h"
#include "views/controls/separator.h"
+#include "views/standard_layout.h"
using base::Time;
diff --git a/chrome/browser/views/select_profile_dialog.cc b/chrome/browser/views/select_profile_dialog.cc
index 074fec6..ff9c0a3 100644
--- a/chrome/browser/views/select_profile_dialog.cc
+++ b/chrome/browser/views/select_profile_dialog.cc
@@ -11,7 +11,6 @@
#include "base/string_util.h"
#include "chrome/browser/user_data_manager.h"
#include "chrome/browser/views/new_profile_dialog.h"
-#include "chrome/browser/views/standard_layout.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -19,6 +18,7 @@
#include "views/controls/label.h"
#include "views/controls/message_box_view.h"
#include "views/grid_layout.h"
+#include "views/standard_layout.h"
#include "views/view.h"
#include "views/window/window.h"
diff --git a/chrome/browser/views/shelf_item_dialog.cc b/chrome/browser/views/shelf_item_dialog.cc
index 70c4e71..b609ad4 100644
--- a/chrome/browser/views/shelf_item_dialog.cc
+++ b/chrome/browser/views/shelf_item_dialog.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/views/shelf_item_dialog.h"
+#include "app/gfx/text_elider.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/gfx/png_decoder.h"
@@ -12,8 +13,6 @@
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/browser/views/standard_layout.h"
-#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
@@ -25,6 +24,7 @@
#include "views/controls/text_field.h"
#include "views/focus/focus_manager.h"
#include "views/grid_layout.h"
+#include "views/standard_layout.h"
#include "views/widget/widget.h"
using base::Time;
diff --git a/chrome/browser/views/standard_layout.h b/chrome/browser/views/standard_layout.h
deleted file mode 100644
index d72c7f3..0000000
--- a/chrome/browser/views/standard_layout.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_VIEWS_STANDARD_LAYOUT_H__
-#define CHROME_BROWSER_VIEWS_STANDARD_LAYOUT_H__
-
-#include "views/grid_layout.h"
-
-//
-// This file contains some constants we use to implement our standard panel
-// layout.
-// see: spec 21/4
-
-// Left or right margin.
-const int kPanelHorizMargin = 13;
-
-// Top or bottom margin.
-const int kPanelVertMargin = 13;
-
-// If some UI has some sub UI. Indent horizontally by the following value.
-const int kPanelHorizIndentation = 24;
-
-// When several controls are aligned vertically, the baseline should be spaced
-// by the following number of pixels.
-const int kPanelVerticalSpacing = 32;
-
-// Vertical spacing between sub UI.
-const int kPanelSubVerticalSpacing = 24;
-
-// Vertical spacing between a label and some control.
-const int kLabelToControlVerticalSpacing = 8;
-
-// Vertical spacing between controls that are logically related.
-const int kRelatedControlVerticalSpacing = 8;
-
-// Small vertical spacing between controls that are logically related.
-const int kRelatedControlSmallVerticalSpacing = 4;
-
-// Vertical spacing between controls that are logically unrelated.
-const int kUnrelatedControlVerticalSpacing = 20;
-
-// Larger vertical spacing between unrelated controls.
-const int kUnrelatedControlLargeVerticalSpacing = 30;
-
-// Small horizontal spacing between controls that are logically related.
-const int kRelatedControlSmallHorizontalSpacing = 8;
-
-// Horizontal spacing between controls that are logically related.
-const int kRelatedControlHorizontalSpacing = 8;
-
-// Horizontal spacing between controls that are logically unrelated.
-const int kUnrelatedControlHorizontalSpacing = 12;
-
-// Larger horizontal spacing between unrelated controls.
-const int kUnrelatedControlLargeHorizontalSpacing = 20;
-
-// Vertical spacing between the edge of the window and the
-// top or bottom of a button.
-const int kButtonVEdgeMargin = 6;
-
-// Vertical spacing between the edge of the window and the
-// left or right of a button.
-const int kButtonHEdgeMargin = 7;
-
-// Horizontal spacing between buttons that are logically related.
-const int kRelatedButtonHSpacing = 6;
-
-// Creates a GridLayout with kPanel*Margin insets.
-static views::GridLayout* CreatePanelGridLayout(views::View* host) {
- views::GridLayout* layout = new views::GridLayout(host);
- layout->SetInsets(kPanelVertMargin, kPanelHorizMargin,
- kPanelVertMargin, kPanelHorizMargin);
- return layout;
-}
-
-#endif // CHROME_BROWSER_VIEWS_STANDARD_LAYOUT_H__
diff --git a/chrome/browser/views/status_bubble_views.cc b/chrome/browser/views/status_bubble_views.cc
index d44c967..6468c7a 100644
--- a/chrome/browser/views/status_bubble_views.cc
+++ b/chrome/browser/views/status_bubble_views.cc
@@ -7,12 +7,12 @@
#include <algorithm>
#include "app/gfx/chrome_canvas.h"
+#include "app/gfx/text_elider.h"
#include "app/l10n_util.h"
#include "app/l10n_util_win.h"
#include "app/animation.h"
#include "app/resource_bundle.h"
#include "base/string_util.h"
-#include "chrome/common/gfx/text_elider.h"
#include "googleurl/src/gurl.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index f4657eb..38cc412 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -19,7 +19,6 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/character_encoding.h"
-#include "chrome/browser/drag_utils.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
@@ -50,6 +49,7 @@
#include "views/controls/button/button_dropdown.h"
#include "views/controls/hwnd_view.h"
#include "views/controls/label.h"
+#include "views/drag_utils.h"
#include "views/widget/tooltip_manager.h"
#include "views/window/non_client_view.h"
#include "views/window/window.h"
@@ -829,7 +829,8 @@ void BrowserToolbarView::WriteDragData(views::View* sender,
drag_utils::SetURLAndDragImage(tab_->GetURL(),
UTF16ToWideHack(tab_->GetTitle()),
- tab_->GetFavIcon(), data);
+ tab_->GetFavIcon(),
+ data);
}
TabContents* BrowserToolbarView::GetTabContents() {
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 06ade17..de01a3e 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -141,6 +141,8 @@
'../app/gfx/chrome_font_mac.mm',
'../app/gfx/chrome_font_skia.cc',
'../app/gfx/chrome_font_win.cc',
+ '../app/gfx/color_utils.cc',
+ '../app/gfx/color_utils.h',
'../app/gfx/favicon_size.h',
'../app/gfx/icon_util.cc',
'../app/gfx/icon_util.h',
@@ -148,6 +150,8 @@
'../app/gfx/path_gtk.cc',
'../app/gfx/path_win.cc',
'../app/gfx/path.h',
+ '../app/gfx/text_elider.cc',
+ '../app/gfx/text_elider.h',
'../app/l10n_util.cc',
'../app/l10n_util.h',
'../app/l10n_util_posix.cc',
@@ -254,12 +258,8 @@
'common/extensions/url_pattern.h',
'common/extensions/user_script.cc',
'common/extensions/user_script.h',
- 'common/gfx/color_utils.cc',
- 'common/gfx/color_utils.h',
'common/gfx/emf.cc',
'common/gfx/emf.h',
- 'common/gfx/text_elider.cc',
- 'common/gfx/text_elider.h',
'common/gfx/utils.h',
'common/gtk_util.cc',
'common/gtk_util.h',
@@ -268,7 +268,6 @@
'common/net/dns.h',
'common/net/url_request_intercept_job.cc',
'common/net/url_request_intercept_job.h',
- 'common/accessibility_types.h',
'common/app_cache/app_cache_context_impl.cc',
'common/app_cache/app_cache_context_impl.h',
'common/app_cache/app_cache_dispatcher.cc',
@@ -1422,7 +1421,6 @@
'browser/views/shelf_item_dialog.cc',
'browser/views/shelf_item_dialog.h',
'browser/views/shell_dialogs_win.cc',
- 'browser/views/standard_layout.h',
'browser/views/star_toggle.cc',
'browser/views/star_toggle.h',
'browser/views/status_bubble_views.cc',
@@ -2617,7 +2615,7 @@
'../app/gfx/chrome_font_unittest.cc',
'common/gfx/emf_unittest.cc',
'../app/gfx/icon_util_unittest.cc',
- 'common/gfx/text_elider_unittest.cc',
+ '../app/gfx/text_elider_unittest.cc',
'common/important_file_writer_unittest.cc',
'common/ipc_message_unittest.cc',
'common/ipc_sync_channel_unittest.cc',
@@ -2980,6 +2978,7 @@
# All .cc, .h under views, except unittests
'../views/accelerator.cc',
'../views/accelerator.h',
+ '../views/accessibility/accessibility_types.h',
'../views/accessibility/view_accessibility.cc',
'../views/accessibility/view_accessibility.h',
'../views/accessibility/view_accessibility_wrapper.cc',
@@ -3082,6 +3081,7 @@
'../views/painter.h',
'../views/repeat_controller.cc',
'../views/repeat_controller.h',
+ '../views/standard_layout.h',
'../views/view.cc',
'../views/view.h',
'../views/view_constants.cc',
diff --git a/chrome/common/accessibility_types.h b/chrome/common/accessibility_types.h
deleted file mode 100644
index b1e6e2e..0000000
--- a/chrome/common/accessibility_types.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_COMMON_ACCESSIBILITY_TYPES_H_
-#define CHROME_COMMON_ACCESSIBILITY_TYPES_H_
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// AccessibilityTypes
-//
-// Provides enumerations used to preserve platform-independence in accessibility
-// functions used in various Views, both in Browser\Views and Views.
-//
-////////////////////////////////////////////////////////////////////////////////
-class AccessibilityTypes {
- public:
- // This defines an enumeration of the supported accessibility roles in our
- // Views (e.g. used in View::GetAccessibleRole). Any interface using roles
- // must provide a conversion to its own roles (see e.g.
- // ViewAccessibility::get_accRole and ViewAccessibility::MSAARole).
- enum Role {
- ROLE_APPLICATION,
- ROLE_BUTTONDROPDOWN,
- ROLE_CLIENT,
- ROLE_GROUPING,
- ROLE_PAGETAB,
- ROLE_PUSHBUTTON,
- ROLE_TEXT,
- ROLE_TOOLBAR
- };
-
- // This defines an enumeration of the supported accessibility roles in our
- // Views (e.g. used in View::GetAccessibleState). Any interface using roles
- // must provide a conversion to its own roles (see e.g.
- // ViewAccessibility::get_accState and ViewAccessibility::MSAAState).
- enum State {
- STATE_HASPOPUP,
- STATE_READONLY
- };
-
- private:
- // Do not instantiate this class.
- AccessibilityTypes() {}
- ~AccessibilityTypes() {}
-};
-
-#endif // CHROME_COMMON_ACCESSIBILITY_TYPES_H_
diff --git a/chrome/common/common.vcproj b/chrome/common/common.vcproj
index 4c2d021..5c6c28f 100644
--- a/chrome/common/common.vcproj
+++ b/chrome/common/common.vcproj
@@ -149,14 +149,6 @@
Name="gfx"
>
<File
- RelativePath=".\gfx\color_utils.cc"
- >
- </File>
- <File
- RelativePath=".\gfx\color_utils.h"
- >
- </File>
- <File
RelativePath=".\gfx\emf.cc"
>
</File>
@@ -165,14 +157,6 @@
>
</File>
<File
- RelativePath=".\gfx\text_elider.cc"
- >
- </File>
- <File
- RelativePath=".\gfx\text_elider.h"
- >
- </File>
- <File
RelativePath=".\gfx\utils.h"
>
</File>
@@ -314,10 +298,6 @@
</File>
</Filter>
<File
- RelativePath=".\accessibility_types.h"
- >
- </File>
- <File
RelativePath=".\bindings_policy.h"
>
</File>
diff --git a/chrome/common/gfx/color_utils.cc b/chrome/common/gfx/color_utils.cc
deleted file mode 100644
index 70437e1..0000000
--- a/chrome/common/gfx/color_utils.cc
+++ /dev/null
@@ -1,268 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "build/build_config.h"
-
-#include <math.h>
-#if defined(OS_WIN)
-#include <windows.h>
-#endif
-
-#include "chrome/common/gfx/color_utils.h"
-
-#include "base/basictypes.h"
-#include "base/logging.h"
-#include "skia/include/SkBitmap.h"
-
-#if defined(OS_WIN)
-#include "skia/ext/skia_utils_win.h"
-#endif
-
-namespace color_utils {
-
-// These transformations are based on the equations in:
-// http://en.wikipedia.org/wiki/Lab_color
-// http://en.wikipedia.org/wiki/SRGB_color_space#Specification_of_the_transformation
-// See also:
-// http://www.brucelindbloom.com/index.html?ColorCalculator.html
-
-static const double kCIEConversionAlpha = 0.055;
-static const double kCIEConversionGamma = 2.2;
-static const double kE = 0.008856;
-static const double kK = 903.3;
-
-static double CIEConvertNonLinear(uint8 color_component) {
- double color_component_d = static_cast<double>(color_component) / 255.0;
- if (color_component_d > 0.04045) {
- double base = (color_component_d + kCIEConversionAlpha) /
- (1 + kCIEConversionAlpha);
- return pow(base, kCIEConversionGamma);
- } else {
- return color_component_d / 12.92;
- }
-}
-
-// Note: this works only for sRGB.
-void SkColorToCIEXYZ(SkColor c, CIE_XYZ* xyz) {
- uint8 r = SkColorGetR(c);
- uint8 g = SkColorGetG(c);
- uint8 b = SkColorGetB(c);
-
- xyz->X =
- 0.4124 * CIEConvertNonLinear(r) +
- 0.3576 * CIEConvertNonLinear(g) +
- 0.1805 * CIEConvertNonLinear(b);
- xyz->Y =
- 0.2126 * CIEConvertNonLinear(r) +
- 0.7152 * CIEConvertNonLinear(g) +
- 0.0722 * CIEConvertNonLinear(g);
- xyz->Z =
- 0.0193 * CIEConvertNonLinear(r) +
- 0.1192 * CIEConvertNonLinear(g) +
- 0.9505 * CIEConvertNonLinear(b);
-}
-
-static double LabConvertNonLinear(double value) {
- if (value > 0.008856) {
- double goat = pow(value, static_cast<double>(1) / 3);
- return goat;
- }
- return (kK * value + 16) / 116;
-}
-
-void CIEXYZToLabColor(const CIE_XYZ& xyz, LabColor* lab) {
- CIE_XYZ white_xyz;
- SkColorToCIEXYZ(SkColorSetRGB(255, 255, 255), &white_xyz);
- double fx = LabConvertNonLinear(xyz.X / white_xyz.X);
- double fy = LabConvertNonLinear(xyz.Y / white_xyz.Y);
- double fz = LabConvertNonLinear(xyz.Z / white_xyz.Z);
- lab->L = static_cast<int>(116 * fy) - 16;
- lab->a = static_cast<int>(500 * (fx - fy));
- lab->b = static_cast<int>(200 * (fy - fz));
-}
-
-static uint8 sRGBColorComponentFromLinearComponent(double component) {
- double result;
- if (component <= 0.0031308) {
- result = 12.92 * component;
- } else {
- result = (1 + kCIEConversionAlpha) *
- pow(component, (static_cast<double>(1) / 2.4)) -
- kCIEConversionAlpha;
- }
- return std::min(static_cast<uint8>(255), static_cast<uint8>(result * 255));
-}
-
-SkColor CIEXYZToSkColor(SkAlpha alpha, const CIE_XYZ& xyz) {
- double r_linear = 3.2410 * xyz.X - 1.5374 * xyz.Y - 0.4986 * xyz.Z;
- double g_linear = -0.9692 * xyz.X + 1.8760 * xyz.Y + 0.0416 * xyz.Z;
- double b_linear = 0.0556 * xyz.X - 0.2040 * xyz.Y + 1.0570 * xyz.Z;
- uint8 r = sRGBColorComponentFromLinearComponent(r_linear);
- uint8 g = sRGBColorComponentFromLinearComponent(g_linear);
- uint8 b = sRGBColorComponentFromLinearComponent(b_linear);
- return SkColorSetARGB(alpha, r, g, b);
-}
-
-static double gen_yr(const LabColor& lab) {
- if (lab.L > (kE * kK))
- return pow((lab.L + 16.0) / 116, 3.0);
- return static_cast<double>(lab.L) / kK;
-}
-
-static double fy(const LabColor& lab) {
- double yr = gen_yr(lab);
- if (yr > kE)
- return (lab.L + 16.0) / 116;
- return (kK * yr + 16.0) / 116;
-}
-
-static double fx(const LabColor& lab) {
- return (static_cast<double>(lab.a) / 500) + fy(lab);
-}
-
-static double gen_xr(const LabColor& lab) {
- double x = fx(lab);
- double x_cubed = pow(x, 3.0);
- if (x_cubed > kE)
- return x_cubed;
- return (116.0 * x - 16.0) / kK;
-}
-
-static double fz(const LabColor& lab) {
- return fy(lab) - (static_cast<double>(lab.b) / 200);
-}
-
-static double gen_zr(const LabColor& lab) {
- double z = fz(lab);
- double z_cubed = pow(z, 3.0);
- if (z_cubed > kE)
- return z_cubed;
- return (116.0 * z - 16.0) / kK;
-}
-
-void LabColorToCIEXYZ(const LabColor& lab, CIE_XYZ* xyz) {
- CIE_XYZ result;
-
- CIE_XYZ white_xyz;
- SkColorToCIEXYZ(SkColorSetRGB(255, 255, 255), &white_xyz);
-
- result.X = gen_xr(lab) * white_xyz.X;
- result.Y = gen_yr(lab) * white_xyz.Y;
- result.Z = gen_zr(lab) * white_xyz.Z;
-
- *xyz = result;
-}
-
-void SkColorToLabColor(SkColor c, LabColor* lab) {
- CIE_XYZ xyz;
- SkColorToCIEXYZ(c, &xyz);
- CIEXYZToLabColor(xyz, lab);
-}
-
-SkColor LabColorToSkColor(const LabColor& lab, SkAlpha alpha) {
- CIE_XYZ xyz;
- LabColorToCIEXYZ(lab, &xyz);
- return CIEXYZToSkColor(alpha, xyz);
-}
-
-static const int kCloseToBoundary = 64;
-static const int kAverageBoundary = 15;
-
-bool IsColorCloseToTransparent(SkAlpha alpha) {
- return alpha < kCloseToBoundary;
-}
-
-bool IsColorCloseToGrey(int r, int g, int b) {
- int average = (r + g + b) / 3;
- return (abs(r - average) < kAverageBoundary) &&
- (abs(g - average) < kAverageBoundary) &&
- (abs(b - average) < kAverageBoundary);
-}
-
-SkColor GetAverageColorOfFavicon(SkBitmap* favicon, SkAlpha alpha) {
- int r = 0, g = 0, b = 0;
-
- SkAutoLockPixels favicon_lock(*favicon);
- SkColor* pixels = static_cast<SkColor*>(favicon->getPixels());
- // Assume ARGB_8888 format.
- DCHECK(favicon->getConfig() == SkBitmap::kARGB_8888_Config);
- SkColor* current_color = pixels;
-
- DCHECK(favicon->width() <= 16 && favicon->height() <= 16);
-
- int pixel_count = favicon->width() * favicon->height();
- int color_count = 0;
- for (int i = 0; i < pixel_count; ++i, ++current_color) {
- // Disregard this color if it is close to black, close to white, or close
- // to transparent since any of those pixels do not contribute much to the
- // color makeup of this icon.
- int cr = SkColorGetR(*current_color);
- int cg = SkColorGetG(*current_color);
- int cb = SkColorGetB(*current_color);
-
- if (IsColorCloseToTransparent(SkColorGetA(*current_color)) ||
- IsColorCloseToGrey(cr, cg, cb))
- continue;
-
- r += cr;
- g += cg;
- b += cb;
- ++color_count;
- }
-
- SkColor result;
- if (color_count > 0) {
- result = SkColorSetARGB(alpha,
- r / color_count,
- g / color_count,
- b / color_count);
- } else {
- result = SkColorSetARGB(alpha, 0, 0, 0);
- }
- return result;
-}
-
-inline int GetLumaForColor(SkColor* color) {
- int r = SkColorGetR(*color);
- int g = SkColorGetG(*color);
- int b = SkColorGetB(*color);
-
- int luma = static_cast<int>(0.3*r + 0.59*g + 0.11*b);
- if (luma < 0)
- luma = 0;
- else if (luma > 255)
- luma = 255;
-
- return luma;
-}
-
-void BuildLumaHistogram(SkBitmap* bitmap, int histogram[256]) {
- SkAutoLockPixels bitmap_lock(*bitmap);
- // Assume ARGB_8888 format.
- DCHECK(bitmap->getConfig() == SkBitmap::kARGB_8888_Config);
-
- int pixel_width = bitmap->width();
- int pixel_height = bitmap->height();
- for (int y = 0; y < pixel_height; ++y) {
- SkColor* current_color = static_cast<uint32_t*>(bitmap->getAddr32(0, y));
- for (int x = 0; x < pixel_width; ++x, ++current_color) {
- histogram[GetLumaForColor(current_color)]++;
- }
- }
-}
-
-SkColor SetColorAlpha(SkColor c, SkAlpha alpha) {
- return SkColorSetARGB(alpha, SkColorGetR(c), SkColorGetG(c), SkColorGetB(c));
-}
-
-SkColor GetSysSkColor(int which) {
-#if defined(OS_WIN)
- return skia::COLORREFToSkColor(::GetSysColor(which));
-#else
- NOTIMPLEMENTED();
- return SK_ColorLTGRAY;
-#endif
-}
-
-} // namespace color_utils
diff --git a/chrome/common/gfx/color_utils.h b/chrome/common/gfx/color_utils.h
deleted file mode 100644
index cdf7659..0000000
--- a/chrome/common/gfx/color_utils.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_COMMON_GFX_COLOR_UTILS_H__
-#define CHROME_COMMON_GFX_COLOR_UTILS_H__
-
-#include "SkColor.h"
-
-class SkBitmap;
-
-namespace color_utils {
-
-// Represents set of CIE XYZ tristimulus values.
-struct CIE_XYZ {
- double X;
- double Y; // luminance
- double Z;
-};
-
-// Represents a L*a*b* color value
-struct LabColor {
- int L;
- int a;
- int b;
-};
-
-// Note: these transformations assume sRGB as the source color space
-
-// Convert between different color spaces
-void SkColorToCIEXYZ(SkColor c, CIE_XYZ* xyz);
-void CIEXYZToLabColor(const CIE_XYZ& xyz, LabColor* lab);
-
-SkColor CIEXYZToSkColor(SkAlpha alpha, const CIE_XYZ& xyz);
-void LabColorToCIEXYZ(const LabColor& lab, CIE_XYZ* xyz);
-
-void SkColorToLabColor(SkColor c, LabColor* lab);
-SkColor LabColorToSkColor(const LabColor& lab, SkAlpha alpha);
-
-// Determine if a given alpha value is nearly completely transparent.
-bool IsColorCloseToTransparent(SkAlpha alpha);
-
-// Determine if a color is near grey.
-bool IsColorCloseToGrey(int r, int g, int b);
-
-// Gets a color representing a bitmap. The definition of "representing" is the
-// average color in the bitmap. The color returned is modified to have the
-// specified alpha.
-SkColor GetAverageColorOfFavicon(SkBitmap* bitmap, SkAlpha alpha);
-
-// Builds a histogram based on the Y' of the Y'UV representation of
-// this image.
-void BuildLumaHistogram(SkBitmap* bitmap, int histogram[256]);
-
-// Create a color from a base color and a specific alpha value.
-SkColor SetColorAlpha(SkColor c, SkAlpha alpha);
-
-// Gets a Windows system color as a SkColor
-SkColor GetSysSkColor(int which);
-
-} // namespace color_utils
-
-#endif // #ifndef CHROME_COMMON_GFX_COLOR_UTILS_H__
diff --git a/chrome/common/gfx/text_elider.cc b/chrome/common/gfx/text_elider.cc
deleted file mode 100644
index 1b0303f..0000000
--- a/chrome/common/gfx/text_elider.cc
+++ /dev/null
@@ -1,517 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "app/gfx/chrome_font.h"
-#include "base/file_path.h"
-#include "base/string_util.h"
-#include "base/sys_string_conversions.h"
-#include "chrome/common/gfx/text_elider.h"
-#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
-#include "googleurl/src/gurl.h"
-#include "net/base/escape.h"
-#include "net/base/net_util.h"
-#include "net/base/registry_controlled_domain.h"
-
-const wchar_t kEllipsis[] = L"\x2026";
-
-namespace gfx {
-
-// Appends the given part of the original URL to the output string formatted for
-// the user. The given parsed structure will be updated. The host name formatter
-// also takes the same accept languages component as ElideURL. |new_parsed| may
-// be null.
-static void AppendFormattedHost(const GURL& url,
- const std::wstring& languages,
- std::wstring* output,
- url_parse::Parsed* new_parsed);
-
-// Calls the unescaper for the substring |in_component| inside of the URL
-// |spec|. The decoded string will be appended to |output| and the resulting
-// range will be filled into |out_component|.
-static void AppendFormattedComponent(const std::string& spec,
- const url_parse::Component& in_component,
- std::wstring* output,
- url_parse::Component* out_component);
-
-// This function takes a GURL object and elides it. It returns a string
-// which composed of parts from subdomain, domain, path, filename and query.
-// A "..." is added automatically at the end if the elided string is bigger
-// than the available pixel width. For available pixel width = 0, a formatted,
-// but un-elided, string is returned.
-//
-// TODO(pkasting): http://b/119635 This whole function gets
-// kerning/ligatures/etc. issues potentially wrong by assuming that the width of
-// a rendered string is always the sum of the widths of its substrings. Also I
-// suspect it could be made simpler.
-std::wstring ElideUrl(const GURL& url,
- const ChromeFont& font,
- int available_pixel_width,
- const std::wstring& languages) {
- // Get a formatted string and corresponding parsing of the url.
- url_parse::Parsed parsed;
- std::wstring url_string = GetCleanStringFromUrl(url, languages, &parsed,
- NULL);
- if (available_pixel_width <= 0)
- return url_string;
-
- // If non-standard or not file type, return plain eliding.
- if (!(url.SchemeIsFile() || url.IsStandard()))
- return ElideText(url_string, font, available_pixel_width);
-
- // Now start eliding url_string to fit within available pixel width.
- // Fist pass - check to see whether entire url_string fits.
- int pixel_width_url_string = font.GetStringWidth(url_string);
- if (available_pixel_width >= pixel_width_url_string)
- return url_string;
-
- // Get the path substring, including query and reference.
- size_t path_start_index = parsed.path.begin;
- size_t path_len = parsed.path.len;
- std::wstring url_path_query_etc = url_string.substr(path_start_index);
- std::wstring url_path = url_string.substr(path_start_index, path_len);
-
- // Return general elided text if url minus the query fits.
- std::wstring url_minus_query = url_string.substr(0, path_start_index +
- path_len);
- if (available_pixel_width >= font.GetStringWidth(url_minus_query))
- return ElideText(url_string, font, available_pixel_width);
-
- // Get Host.
- std::wstring url_host = UTF8ToWide(url.host());
-
- // Get domain and registry information from the URL.
- std::wstring url_domain = UTF8ToWide(
- net::RegistryControlledDomainService::GetDomainAndRegistry(url));
- if (url_domain.empty())
- url_domain = url_host;
-
- // Add port if required.
- if (!url.port().empty()){
- url_host += L":" + UTF8ToWide(url.port());
- url_domain += L":" + UTF8ToWide(url.port());
- }
-
- // Get sub domain.
- std::wstring url_subdomain;
- size_t domain_start_index = url_host.find(url_domain);
- if (domain_start_index > 0)
- url_subdomain = url_host.substr(0, domain_start_index);
- if ((url_subdomain == L"www." || url_subdomain.empty() ||
- url.SchemeIsFile())) {
- url_subdomain.clear();
- }
-
- // If this is a file type, the path is now defined as everything after ":".
- // For example, "C:/aa/aa/bb", the path is "/aa/bb/cc". Interesting, the
- // domain is now C: - this is a nice hack for eliding to work pleasantly.
- if (url.SchemeIsFile()) {
- // Split the path string using ":"
- std::vector<std::wstring> file_path_split;
- SplitString(url_path, L':', &file_path_split);
- if (file_path_split.size() > 1) { // File is of type "file:///C:/.."
- url_host.clear();
- url_domain.clear();
- url_subdomain.clear();
-
- url_host = url_domain = file_path_split.at(0).substr(1) + L":";
- url_path_query_etc = url_path = file_path_split.at(1);
- }
- }
-
- // Second Pass - remove scheme - the rest fits.
- int pixel_width_url_host = font.GetStringWidth(url_host);
- int pixel_width_url_path = font.GetStringWidth(url_path_query_etc);
- if (available_pixel_width >=
- pixel_width_url_host + pixel_width_url_path)
- return url_host + url_path_query_etc;
-
- // Third Pass: Subdomain, domain and entire path fits.
- int pixel_width_url_domain = font.GetStringWidth(url_domain);
- int pixel_width_url_subdomain = font.GetStringWidth(url_subdomain);
- if (available_pixel_width >=
- pixel_width_url_subdomain + pixel_width_url_domain +
- pixel_width_url_path)
- return url_subdomain + url_domain + url_path_query_etc;
-
- // Query element.
- std::wstring url_query;
- const int pixel_width_dots_trailer = font.GetStringWidth(kEllipsis);
- if (parsed.query.is_nonempty()) {
- url_query = std::wstring(L"?") + url_string.substr(parsed.query.begin);
- if (available_pixel_width >= (pixel_width_url_subdomain +
- pixel_width_url_domain + pixel_width_url_path -
- font.GetStringWidth(url_query))) {
- return ElideText(url_subdomain + url_domain + url_path_query_etc, font,
- available_pixel_width);
- }
- }
-
- // Parse url_path using '/'.
- std::vector<std::wstring> url_path_elements;
- SplitString(url_path, L'/', &url_path_elements);
-
- // Get filename - note that for a path ending with /
- // such as www.google.com/intl/ads/, the file name is ads/.
- int url_path_number_of_elements = static_cast<int> (url_path_elements.
- size());
- std::wstring url_filename;
- if ((url_path_elements.at(url_path_number_of_elements - 1)).length() > 0) {
- url_filename = *(url_path_elements.end()-1);
- } else if (url_path_number_of_elements > 1) { // Path ends with a '/'.
- url_filename = url_path_elements.at(url_path_number_of_elements - 2) +
- L'/';
- url_path_number_of_elements--;
- }
-
- const int kMaxNumberOfUrlPathElementsAllowed = 1024;
- if (url_path_number_of_elements <= 1 ||
- url_path_number_of_elements > kMaxNumberOfUrlPathElementsAllowed) {
- // No path to elide, or too long of a path (could overflow in loop below)
- // Just elide this as a text string.
- return ElideText(url_subdomain + url_domain + url_path_query_etc, font,
- available_pixel_width);
- }
-
- // Start eliding the path and replacing elements by "../".
- std::wstring an_ellipsis_and_a_slash(kEllipsis);
- an_ellipsis_and_a_slash += L'/';
- int pixel_width_url_filename = font.GetStringWidth(url_filename);
- int pixel_width_dot_dot_slash = font.GetStringWidth(an_ellipsis_and_a_slash);
- int pixel_width_slash = font.GetStringWidth(L"/");
- int pixel_width_url_path_elements[kMaxNumberOfUrlPathElementsAllowed];
- for (int i = 0; i < url_path_number_of_elements; ++i) {
- pixel_width_url_path_elements[i] =
- font.GetStringWidth(url_path_elements.at(i));
- }
-
- // Check with both subdomain and domain.
- std::wstring elided_path;
- int pixel_width_elided_path;
- for (int i = url_path_number_of_elements - 1; i >= 1; --i) {
- // Add the initial elements of the path.
- elided_path.clear();
- pixel_width_elided_path = 0;
- for (int j = 0; j < i; ++j) {
- elided_path += url_path_elements.at(j) + L'/';
- pixel_width_elided_path += pixel_width_url_path_elements[j] +
- pixel_width_slash;
- }
-
- // Add url_file_name.
- if (i == (url_path_number_of_elements - 1)) {
- elided_path += url_filename;
- pixel_width_elided_path += pixel_width_url_filename;
- } else {
- elided_path += an_ellipsis_and_a_slash + url_filename;
- pixel_width_elided_path += pixel_width_dot_dot_slash +
- pixel_width_url_filename;
- }
-
- if (available_pixel_width >=
- pixel_width_url_subdomain + pixel_width_url_domain +
- pixel_width_elided_path) {
- return ElideText(url_subdomain + url_domain + elided_path + url_query,
- font, available_pixel_width);
- }
- }
-
- // Check with only domain.
- // If a subdomain is present, add an ellipsis before domain.
- // This is added only if the subdomain pixel width is larger than
- // the pixel width of kEllipsis. Otherwise, subdomain remains,
- // which means that this case has been resolved earlier.
- std::wstring url_elided_domain = url_subdomain + url_domain;
- int pixel_width_url_elided_domain = pixel_width_url_domain;
- if (pixel_width_url_subdomain > pixel_width_dots_trailer) {
- if (!url_subdomain.empty()) {
- url_elided_domain = kEllipsis + url_domain;
- pixel_width_url_elided_domain += pixel_width_dots_trailer;
- } else {
- url_elided_domain = url_domain;
- }
-
- for (int i = url_path_number_of_elements - 1; i >= 1; --i) {
- // Add the initial elements of the path.
- elided_path.clear();
- pixel_width_elided_path = 0;
- for (int j = 0; j < i; ++j) {
- elided_path += url_path_elements.at(j) + L'/';
- pixel_width_elided_path += pixel_width_url_path_elements[j] +
- pixel_width_slash;
- }
-
- // Add url_file_name.
- if (i == (url_path_number_of_elements - 1)) {
- elided_path += url_filename;
- pixel_width_elided_path += pixel_width_url_filename;
- } else {
- elided_path += an_ellipsis_and_a_slash + url_filename;
- pixel_width_elided_path += pixel_width_dot_dot_slash +
- pixel_width_url_filename;
- }
-
- if (available_pixel_width >=
- pixel_width_url_elided_domain + pixel_width_elided_path) {
- return ElideText(url_elided_domain + elided_path + url_query, font,
- available_pixel_width);
- }
- }
- }
-
- // Return elided domain/../filename anyway.
- std::wstring final_elided_url_string(url_elided_domain);
- if ((available_pixel_width - font.GetStringWidth(url_elided_domain)) >
- pixel_width_dot_dot_slash + pixel_width_dots_trailer +
- font.GetStringWidth(L"UV")) // A hack to prevent trailing "../...".
- final_elided_url_string += elided_path;
- else
- final_elided_url_string += url_path;
-
- return ElideText(final_elided_url_string, font, available_pixel_width);
-}
-
-std::wstring ElideFilename(const FilePath& filename,
- const ChromeFont& font,
- int available_pixel_width) {
- int full_width = font.GetStringWidth(filename.ToWStringHack());
- if (full_width <= available_pixel_width)
- return filename.ToWStringHack();
-
-#if defined(OS_WIN)
- std::wstring extension = filename.Extension();
-#elif defined(OS_POSIX)
- std::wstring extension = base::SysNativeMBToWide(filename.Extension());
-#endif
- std::wstring rootname =
- filename.BaseName().RemoveExtension().ToWStringHack();
-
- if (rootname.empty() || extension.empty())
- return ElideText(filename.ToWStringHack(), font, available_pixel_width);
-
- int ext_width = font.GetStringWidth(extension);
- int root_width = font.GetStringWidth(rootname);
-
- // We may have trimmed the path.
- if (root_width + ext_width <= available_pixel_width)
- return rootname + extension;
-
- int available_root_width = available_pixel_width - ext_width;
- return ElideText(rootname, font, available_root_width) + extension;
-}
-
-// This function adds an ellipsis at the end of the text if the text
-// does not fit the given pixel width.
-std::wstring ElideText(const std::wstring& text,
- const ChromeFont& font,
- int available_pixel_width){
- if (text.empty())
- return text;
-
- int current_text_pixel_width = font.GetStringWidth(text);
- if (current_text_pixel_width <= available_pixel_width)
- return text;
-
- if (font.GetStringWidth(kEllipsis) > available_pixel_width)
- return std::wstring();
-
- // Use binary search to compute the elided text.
- size_t lo = 0;
- size_t hi = text.length() - 1;
- size_t guess = hi / 2;
- while (lo < hi) {
- // We check the length of the whole desired string at once to ensure we
- // handle kerning/ligatures/etc. correctly.
- std::wstring guess_str = text.substr(0, guess) + kEllipsis;
- int guess_length = font.GetStringWidth(guess_str);
- if (guess_length > available_pixel_width) {
- if (hi == guess)
- break;
- hi = guess;
- } else {
- if (lo == guess)
- break;
- lo = guess;
- }
- guess = (lo + hi) / 2;
- }
-
- return text.substr(0, lo) + kEllipsis;
-}
-
-void AppendFormattedHost(const GURL& url,
- const std::wstring& languages,
- std::wstring* output,
- url_parse::Parsed* new_parsed) {
- const url_parse::Component& host =
- url.parsed_for_possibly_invalid_spec().host;
-
- if (host.is_nonempty()) {
- // Handle possible IDN in the host name.
- if (new_parsed)
- new_parsed->host.begin = static_cast<int>(output->length());
-
- const std::string& spec = url.possibly_invalid_spec();
- DCHECK(host.begin >= 0 &&
- ((spec.length() == 0 && host.begin == 0) ||
- host.begin < static_cast<int>(spec.length())));
- net::IDNToUnicode(&spec[host.begin], host.len, languages, output);
-
- if (new_parsed) {
- new_parsed->host.len =
- static_cast<int>(output->length()) - new_parsed->host.begin;
- }
- } else if (new_parsed) {
- new_parsed->host.reset();
- }
-}
-
-void AppendFormattedComponent(const std::string& spec,
- const url_parse::Component& in_component,
- std::wstring* output,
- url_parse::Component* out_component) {
- if (in_component.is_nonempty()) {
- out_component->begin = static_cast<int>(output->length());
-
- output->append(UnescapeAndDecodeUTF8URLComponent(
- spec.substr(in_component.begin, in_component.len),
- UnescapeRule::NORMAL));
-
- out_component->len =
- static_cast<int>(output->length()) - out_component->begin;
- } else {
- out_component->reset();
- }
-}
-
-std::wstring GetCleanStringFromUrl(const GURL& url,
- const std::wstring& languages,
- url_parse::Parsed* new_parsed,
- size_t* prefix_end) {
- url_parse::Parsed parsed_temp;
- if (!new_parsed)
- new_parsed = &parsed_temp;
-
- std::wstring url_string;
-
- // Check for empty URLs or 0 available text width.
- if (url.is_empty()) {
- if (prefix_end)
- *prefix_end = 0;
- return url_string;
- }
-
- // We handle both valid and invalid URLs (this will give us the spec
- // regardless of validity).
- const std::string& spec = url.possibly_invalid_spec();
- const url_parse::Parsed& parsed = url.parsed_for_possibly_invalid_spec();
-
- // Construct a new URL with the username and password fields removed. We
- // don't want to display those to the user since they can be used for
- // attacks, e.g. "http://google.com:search@evil.ru/"
- //
- // Copy everything before the host name we want (the scheme and the
- // separators), minus the username start we computed above. These are ASCII.
- int pre_end = parsed.CountCharactersBefore(
- url_parse::Parsed::USERNAME, true);
- for (int i = 0; i < pre_end; ++i)
- url_string.push_back(spec[i]);
- if (prefix_end)
- *prefix_end = static_cast<size_t>(pre_end);
- new_parsed->scheme = parsed.scheme;
- new_parsed->username.reset();
- new_parsed->password.reset();
-
- AppendFormattedHost(url, languages, &url_string, new_parsed);
-
- // Port.
- if (parsed.port.is_nonempty()) {
- url_string.push_back(':');
- for (int i = parsed.port.begin; i < parsed.port.end(); ++i)
- url_string.push_back(spec[i]);
- }
-
- // Path and query both get the same general unescape & convert treatment.
- AppendFormattedComponent(spec, parsed.path, &url_string, &new_parsed->path);
- if (parsed.query.is_valid())
- url_string.push_back('?');
- AppendFormattedComponent(spec, parsed.query, &url_string, &new_parsed->query);
-
- // Reference is stored in valid, unescaped UTF-8, so we can just convert.
- if (parsed.ref.is_valid()) {
- url_string.push_back('#');
- if (parsed.ref.len > 0)
- url_string.append(UTF8ToWide(std::string(&spec[parsed.ref.begin],
- parsed.ref.len)));
- }
-
- return url_string;
-}
-
-SortedDisplayURL::SortedDisplayURL(const GURL& url,
- const std::wstring& languages) {
- std::wstring host;
- AppendFormattedHost(url, languages, &host, NULL);
- sort_host_ = WideToUTF16Hack(host);
- string16 host_minus_www = WideToUTF16Hack(net::StripWWW(host));
- url_parse::Parsed parsed;
- display_url_ = WideToUTF16Hack(GetCleanStringFromUrl(url, languages,
- &parsed, &prefix_end_));
- if (sort_host_.length() > host_minus_www.length()) {
- prefix_end_ += sort_host_.length() - host_minus_www.length();
- sort_host_.swap(host_minus_www);
- }
-}
-
-int SortedDisplayURL::Compare(const SortedDisplayURL& other,
- Collator* collator) const {
- // Compare on hosts first. The host won't contain 'www.'.
- UErrorCode compare_status = U_ZERO_ERROR;
- UCollationResult host_compare_result = collator->compare(
- static_cast<const UChar*>(sort_host_.c_str()),
- static_cast<int>(sort_host_.length()),
- static_cast<const UChar*>(other.sort_host_.c_str()),
- static_cast<int>(other.sort_host_.length()),
- compare_status);
- DCHECK(U_SUCCESS(compare_status));
- if (host_compare_result != 0)
- return host_compare_result;
-
- // Hosts match, compare on the portion of the url after the host.
- string16 path = this->AfterHost();
- string16 o_path = other.AfterHost();
- compare_status = U_ZERO_ERROR;
- UCollationResult path_compare_result = collator->compare(
- static_cast<const UChar*>(path.c_str()),
- static_cast<int>(path.length()),
- static_cast<const UChar*>(o_path.c_str()),
- static_cast<int>(o_path.length()),
- compare_status);
- DCHECK(U_SUCCESS(compare_status));
- if (path_compare_result != 0)
- return path_compare_result;
-
- // Hosts and paths match, compare on the complete url. This'll push the www.
- // ones to the end.
- compare_status = U_ZERO_ERROR;
- UCollationResult display_url_compare_result = collator->compare(
- static_cast<const UChar*>(display_url_.c_str()),
- static_cast<int>(display_url_.length()),
- static_cast<const UChar*>(other.display_url_.c_str()),
- static_cast<int>(other.display_url_.length()),
- compare_status);
- DCHECK(U_SUCCESS(compare_status));
- return display_url_compare_result;
-}
-
-string16 SortedDisplayURL::AfterHost() const {
- size_t slash_index = display_url_.find(sort_host_, prefix_end_);
- if (slash_index == string16::npos) {
- NOTREACHED();
- return string16();
- }
- return display_url_.substr(slash_index + sort_host_.length());
-}
-
-} // namespace gfx.
diff --git a/chrome/common/gfx/text_elider.h b/chrome/common/gfx/text_elider.h
deleted file mode 100644
index 61bfada..0000000
--- a/chrome/common/gfx/text_elider.h
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_COMMON_GFX_TEXT_ELIDER_H_
-#define CHROME_COMMON_GFX_TEXT_ELIDER_H_
-
-#include <unicode/coll.h>
-#include <unicode/uchar.h>
-
-#include "app/gfx/chrome_font.h"
-#include "base/basictypes.h"
-#include "base/string16.h"
-
-class FilePath;
-class GURL;
-
-namespace url_parse {
-struct Parsed;
-}
-
-// TODO(port): this file should deal in string16s rather than wstrings.
-namespace gfx {
-
-// A function to get URL string from a GURL that will be suitable for display
-// to the user. The parsing of the URL may change because various parts of the
-// string will change lengths. The new parsing will be placed in the given out
-// parameter. |prefix_end| is set to the end of the prefix (spec and separator
-// characters before host).
-// |languages|, |new_parsed|, and |prefix_end| may all be empty or NULL.
-std::wstring GetCleanStringFromUrl(const GURL& url,
- const std::wstring& languages,
- url_parse::Parsed* new_parsed,
- size_t* prefix_end);
-
-// This function takes a GURL object and elides it. It returns a string
-// which composed of parts from subdomain, domain, path, filename and query.
-// A "..." is added automatically at the end if the elided string is bigger
-// than the available pixel width. For available pixel width = 0, empty
-// string is returned. |languages| is a comma separted list of ISO 639
-// language codes and is used to determine what characters are understood
-// by a user. It should come from |prefs::kAcceptLanguages|.
-//
-// Note: in RTL locales, if the URL returned by this function is going to be
-// displayed in the UI, then it is likely that the string needs to be marked
-// as an LTR string (using l10n_util::WrapStringWithLTRFormatting()) so that it
-// is displayed properly in an RTL context. Please refer to
-// http://crbug.com/6487 for more information.
-std::wstring ElideUrl(const GURL& url,
- const ChromeFont& font,
- int available_pixel_width,
- const std::wstring& languages);
-
-std::wstring ElideText(const std::wstring& text,
- const ChromeFont& font,
- int available_pixel_width);
-
-// Elide a filename to fit a given pixel width, with an emphasis on not hiding
-// the extension unless we have to. If filename contains a path, the path will
-// be removed if filename doesn't fit into available_pixel_width.
-std::wstring ElideFilename(const FilePath& filename,
- const ChromeFont& font,
- int available_pixel_width);
-
-// SortedDisplayURL maintains a string from a URL suitable for display to the
-// use. SortedDisplayURL also provides a function used for comparing two
-// SortedDisplayURLs for use in visually ordering the SortedDisplayURLs.
-//
-// SortedDisplayURL is relatively cheap and supports value semantics.
-class SortedDisplayURL {
- public:
- SortedDisplayURL(const GURL& url, const std::wstring& languages);
- SortedDisplayURL() {}
-
- // Compares this SortedDisplayURL to |url| using |collator|. Returns a value
- // < 0, = 1 or > 0 as to whether this url is less then, equal to or greater
- // than the supplied url.
- int Compare(const SortedDisplayURL& other, Collator* collator) const;
-
- // Returns the display string for the URL.
- const string16& display_url() const { return display_url_; }
-
- private:
- // Returns everything after the host. This is used by Compare if the hosts
- // match.
- string16 AfterHost() const;
-
- // Host name minus 'www.'. Used by Compare.
- string16 sort_host_;
-
- // End of the prefix (spec and separator) in display_url_.
- size_t prefix_end_;
-
- string16 display_url_;
-};
-
-} // namespace gfx.
-
-#endif // CHROME_COMMON_GFX_TEXT_ELIDER_H_
diff --git a/chrome/common/gfx/text_elider_unittest.cc b/chrome/common/gfx/text_elider_unittest.cc
deleted file mode 100644
index 3a2eb6d..0000000
--- a/chrome/common/gfx/text_elider_unittest.cc
+++ /dev/null
@@ -1,267 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "app/gfx/chrome_font.h"
-#include "base/file_path.h"
-#include "base/string_util.h"
-#include "chrome/common/gfx/text_elider.h"
-#include "googleurl/src/gurl.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-using namespace gfx;
-
-namespace {
-
-const wchar_t kEllipsis[] = L"\x2026";
-
-struct Testcase {
- const std::string input;
- const std::wstring output;
-};
-
-struct FileTestcase {
- const FilePath::StringType input;
- const std::wstring output;
-};
-
-struct WideTestcase {
- const std::wstring input;
- const std::wstring output;
-};
-
-struct TestData {
- const std::string a;
- const std::string b;
- const int compare_result;
-};
-
-void RunTest(Testcase* testcases, size_t num_testcases) {
- static const ChromeFont font;
- for (size_t i = 0; i < num_testcases; ++i) {
- const GURL url(testcases[i].input);
- // Should we test with non-empty language list?
- // That's kinda redundant with net_util_unittests.
- EXPECT_EQ(testcases[i].output,
- ElideUrl(url, font, font.GetStringWidth(testcases[i].output),
- std::wstring()));
- }
-}
-
-} // namespace
-
-// Test eliding of commonplace URLs.
-TEST(TextEliderTest, TestGeneralEliding) {
- const std::wstring kEllipsisStr(kEllipsis);
- Testcase testcases[] = {
- {"http://www.google.com/intl/en/ads/",
- L"http://www.google.com/intl/en/ads/"},
- {"http://www.google.com/intl/en/ads/", L"www.google.com/intl/en/ads/"},
-// TODO(port): make this test case work on mac.
-#if !defined(OS_MACOSX)
- {"http://www.google.com/intl/en/ads/",
- L"google.com/intl/" + kEllipsisStr + L"/ads/"},
-#endif
- {"http://www.google.com/intl/en/ads/",
- L"google.com/" + kEllipsisStr + L"/ads/"},
- {"http://www.google.com/intl/en/ads/", L"google.com/" + kEllipsisStr},
- {"http://www.google.com/intl/en/ads/", L"goog" + kEllipsisStr},
- {"https://subdomain.foo.com/bar/filename.html",
- L"subdomain.foo.com/bar/filename.html"},
- {"https://subdomain.foo.com/bar/filename.html",
- L"subdomain.foo.com/" + kEllipsisStr + L"/filename.html"},
- {"http://subdomain.foo.com/bar/filename.html",
- kEllipsisStr + L"foo.com/" + kEllipsisStr + L"/filename.html"},
- {"http://www.google.com/intl/en/ads/?aLongQueryWhichIsNotRequired",
- L"http://www.google.com/intl/en/ads/?aLongQ" + kEllipsisStr},
- };
-
- RunTest(testcases, arraysize(testcases));
-}
-
-// Test eliding of empty strings, URLs with ports, passwords, queries, etc.
-TEST(TextEliderTest, TestMoreEliding) {
- const std::wstring kEllipsisStr(kEllipsis);
- Testcase testcases[] = {
- {"http://www.google.com/foo?bar", L"http://www.google.com/foo?bar"},
- {"http://xyz.google.com/foo?bar", L"xyz.google.com/foo?" + kEllipsisStr},
- {"http://xyz.google.com/foo?bar", L"xyz.google.com/foo" + kEllipsisStr},
- {"http://xyz.google.com/foo?bar", L"xyz.google.com/fo" + kEllipsisStr},
- {"http://a.b.com/pathname/c?d", L"a.b.com/" + kEllipsisStr + L"/c?d"},
- {"", L""},
- {"http://foo.bar..example.com...hello/test/filename.html",
- L"foo.bar..example.com...hello/" + kEllipsisStr + L"/filename.html"},
- {"http://foo.bar../", L"http://foo.bar../"},
- {"http://xn--1lq90i.cn/foo", L"http://\x5317\x4eac.cn/foo"},
- {"http://me:mypass@secrethost.com:99/foo?bar#baz",
- L"http://secrethost.com:99/foo?bar#baz"},
- {"http://me:mypass@ss%xxfdsf.com/foo", L"http://ss%25xxfdsf.com/foo"},
- {"mailto:elgoato@elgoato.com", L"mailto:elgoato@elgoato.com"},
- {"javascript:click(0)", L"javascript:click(0)"},
- {"https://chess.eecs.berkeley.edu:4430/login/arbitfilename",
- L"chess.eecs.berkeley.edu:4430/login/arbitfilename"},
- {"https://chess.eecs.berkeley.edu:4430/login/arbitfilename",
- kEllipsisStr + L"berkeley.edu:4430/" + kEllipsisStr + L"/arbitfilename"},
-
- // Unescaping.
- {"http://www/%E4%BD%A0%E5%A5%BD?q=%E4%BD%A0%E5%A5%BD#\xe4\xbd\xa0",
- L"http://www/\x4f60\x597d?q=\x4f60\x597d#\x4f60"},
-
- // Invalid unescaping for path. The ref will always be valid UTF-8. We don't
- // bother to do too many edge cases, since these are handled by the escaper
- // unittest.
- {"http://www/%E4%A0%E5%A5%BD?q=%E4%BD%A0%E5%A5%BD#\xe4\xbd\xa0",
- L"http://www/%E4%A0%E5%A5%BD?q=\x4f60\x597d#\x4f60"},
- };
-
- RunTest(testcases, arraysize(testcases));
-}
-
-// Test eliding of file: URLs.
-TEST(TextEliderTest, TestFileURLEliding) {
- const std::wstring kEllipsisStr(kEllipsis);
- Testcase testcases[] = {
- {"file:///C:/path1/path2/path3/filename",
- L"file:///C:/path1/path2/path3/filename"},
- {"file:///C:/path1/path2/path3/filename",
- L"C:/path1/path2/path3/filename"},
-// GURL parses "file:///C:path" differently on windows than it does on posix.
-#if defined(OS_WIN)
- {"file:///C:path1/path2/path3/filename",
- L"C:/path1/path2/" + kEllipsisStr + L"/filename"},
- {"file:///C:path1/path2/path3/filename",
- L"C:/path1/" + kEllipsisStr + L"/filename"},
- {"file:///C:path1/path2/path3/filename",
- L"C:/" + kEllipsisStr + L"/filename"},
-#endif
- {"file://filer/foo/bar/file", L"filer/foo/bar/file"},
- {"file://filer/foo/bar/file", L"filer/foo/" + kEllipsisStr + L"/file"},
- {"file://filer/foo/bar/file", L"filer/" + kEllipsisStr + L"/file"},
- };
-
- RunTest(testcases, arraysize(testcases));
-}
-
-TEST(TextEliderTest, TestFilenameEliding) {
- const std::wstring kEllipsisStr(kEllipsis);
- const FilePath::StringType kPathSeparator =
- FilePath::StringType().append(1, FilePath::kSeparators[0]);
-
- FileTestcase testcases[] = {
- {FILE_PATH_LITERAL(""), L""},
- {FILE_PATH_LITERAL("."), L"."},
- {FILE_PATH_LITERAL("filename.exe"), L"filename.exe"},
- {FILE_PATH_LITERAL(".longext"), L".longext"},
- {FILE_PATH_LITERAL("pie"), L"pie"},
- {FILE_PATH_LITERAL("c:") + kPathSeparator + FILE_PATH_LITERAL("path") +
- kPathSeparator + FILE_PATH_LITERAL("filename.pie"),
- L"filename.pie"},
- {FILE_PATH_LITERAL("c:") + kPathSeparator + FILE_PATH_LITERAL("path") +
- kPathSeparator + FILE_PATH_LITERAL("longfilename.pie"),
- L"long" + kEllipsisStr + L".pie"},
- {FILE_PATH_LITERAL("http://path.com/filename.pie"), L"filename.pie"},
- {FILE_PATH_LITERAL("http://path.com/longfilename.pie"),
- L"long" + kEllipsisStr + L".pie"},
- {FILE_PATH_LITERAL("piesmashingtacularpants"), L"pie" + kEllipsisStr},
- {FILE_PATH_LITERAL(".piesmashingtacularpants"), L".pie" + kEllipsisStr},
- {FILE_PATH_LITERAL("cheese."), L"cheese."},
- {FILE_PATH_LITERAL("file name.longext"),
- L"file" + kEllipsisStr + L".longext"},
- {FILE_PATH_LITERAL("fil ename.longext"),
- L"fil " + kEllipsisStr + L".longext"},
- {FILE_PATH_LITERAL("filename.longext"),
- L"file" + kEllipsisStr + L".longext"},
- {FILE_PATH_LITERAL("filename.middleext.longext"),
- L"filename.mid" + kEllipsisStr + L".longext"}
- };
-
- static const ChromeFont font;
- for (size_t i = 0; i < arraysize(testcases); ++i) {
- FilePath filepath(testcases[i].input);
- EXPECT_EQ(testcases[i].output, ElideFilename(filepath,
- font,
- font.GetStringWidth(testcases[i].output)));
- }
-}
-
-TEST(TextEliderTest, ElideTextLongStrings) {
- const std::wstring kEllipsisStr(kEllipsis);
- std::wstring data_scheme(L"data:text/plain,");
-
- std::wstring ten_a(10, L'a');
- std::wstring hundred_a(100, L'a');
- std::wstring thousand_a(1000, L'a');
- std::wstring ten_thousand_a(10000, L'a');
- std::wstring hundred_thousand_a(100000, L'a');
- std::wstring million_a(1000000, L'a');
-
- WideTestcase testcases[] = {
- {data_scheme + ten_a,
- data_scheme + ten_a},
- {data_scheme + hundred_a,
- data_scheme + hundred_a},
- {data_scheme + thousand_a,
- data_scheme + std::wstring(156, L'a') + kEllipsisStr},
- {data_scheme + ten_thousand_a,
- data_scheme + std::wstring(156, L'a') + kEllipsisStr},
- {data_scheme + hundred_thousand_a,
- data_scheme + std::wstring(156, L'a') + kEllipsisStr},
- {data_scheme + million_a,
- data_scheme + std::wstring(156, L'a') + kEllipsisStr},
- };
-
- const ChromeFont font;
- int ellipsis_width = font.GetStringWidth(kEllipsisStr);
- for (size_t i = 0; i < arraysize(testcases); ++i) {
- // Compare sizes rather than actual contents because if the test fails,
- // output is rather long.
- EXPECT_EQ(testcases[i].output.size(),
- ElideText(testcases[i].input, font,
- font.GetStringWidth(testcases[i].output)).size());
- EXPECT_EQ(kEllipsisStr,
- ElideText(testcases[i].input, font, ellipsis_width));
- }
-}
-
-// Verifies display_url is set correctly.
-TEST(TextEliderTest, SortedDisplayURL) {
- gfx::SortedDisplayURL d_url(GURL("http://www.google.com/"), std::wstring());
- EXPECT_EQ("http://www.google.com/", UTF16ToASCII(d_url.display_url()));
-}
-
-// Verifies DisplayURL::Compare works correctly.
-TEST(TextEliderTest, SortedDisplayURLCompare) {
- UErrorCode create_status = U_ZERO_ERROR;
- scoped_ptr<Collator> collator(Collator::createInstance(create_status));
- if (!U_SUCCESS(create_status))
- return;
-
- TestData tests[] = {
- // IDN comparison. Hosts equal, so compares on path.
- { "http://xn--1lq90i.cn/a", "http://xn--1lq90i.cn/b", -1},
-
- // Because the host and after host match, this compares the full url.
- { "http://www.x/b", "http://x/b", -1 },
-
- // Because the host and after host match, this compares the full url.
- { "http://www.a:1/b", "http://a:1/b", 1 },
-
- // The hosts match, so these end up comparing on the after host portion.
- { "http://www.x:0/b", "http://x:1/b", -1 },
- { "http://www.x/a", "http://x/b", -1 },
- { "http://x/b", "http://www.x/a", 1 },
-
- // Trivial Equality.
- { "http://a/", "http://a/", 0 },
-
- // Compares just hosts.
- { "http://www.a/", "http://b/", -1 },
- };
-
- for (size_t i = 0; i < arraysize(tests); ++i) {
- gfx::SortedDisplayURL url1(GURL(tests[i].a), std::wstring());
- gfx::SortedDisplayURL url2(GURL(tests[i].b), std::wstring());
- EXPECT_EQ(tests[i].compare_result, url1.Compare(url2, collator.get()));
- EXPECT_EQ(-tests[i].compare_result, url2.Compare(url1, collator.get()));
- }
-}
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 2c46555..2b3c250 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
+#include "app/gfx/color_utils.h"
#include "app/gfx/favicon_size.h"
#include "app/l10n_util.h"
#include "app/message_box_flags.h"
@@ -21,7 +22,6 @@
#include "build/build_config.h"
#include "chrome/common/bindings_policy.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/gfx/color_utils.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/page_zoom.h"
#include "chrome/common/render_messages.h"
diff --git a/chrome/test/unit/unittests.vcproj b/chrome/test/unit/unittests.vcproj
index 7b0a8ed..0904a9b 100644
--- a/chrome/test/unit/unittests.vcproj
+++ b/chrome/test/unit/unittests.vcproj
@@ -1016,10 +1016,6 @@
>
</File>
<File
- RelativePath="..\..\common\gfx\text_elider_unittest.cc"
- >
- </File>
- <File
RelativePath="..\..\common\time_format_unittest.cc"
>
</File>
@@ -1111,6 +1107,10 @@
RelativePath="..\..\..\app\os_exchange_data_unittest.cc"
>
</File>
+ <File
+ RelativePath="..\..\..\app\gfx\text_elider_unittest.cc"
+ >
+ </File>
</Filter>
</Files>
<Globals>