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

Side by Side Diff: content/shell/shell_gtk.cc

Issue 9834092: Content shell: Use only public API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/shell/shell_download_manager_delegate.cc ('k') | content/shell/shell_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/shell/shell.h" 5 #include "content/shell/shell.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/string_piece.h" 12 #include "base/string_piece.h"
13 #include "content/public/browser/browser_context.h" 13 #include "content/public/browser/browser_context.h"
14 #include "content/public/browser/native_web_keyboard_event.h" 14 #include "content/public/browser/native_web_keyboard_event.h"
15 #include "content/browser/tab_contents/tab_contents.h" 15 #include "content/public/browser/web_contents.h"
16 #include "content/browser/tab_contents/tab_contents_view_gtk.h" 16 #include "content/public/browser/web_contents_view.h"
17 #include "content/public/common/renderer_preferences.h"
17 #include "third_party/skia/include/core/SkColor.h" 18 #include "third_party/skia/include/core/SkColor.h"
18 19
19 namespace content { 20 namespace content {
20 21
21 void Shell::PlatformInitialize() { 22 void Shell::PlatformInitialize() {
22 gtk_init(NULL, NULL); 23 gtk_init(NULL, NULL);
23 } 24 }
24 25
25 base::StringPiece Shell::PlatformResourceProvider(int key) { 26 base::StringPiece Shell::PlatformResourceProvider(int key) {
26 NOTIMPLEMENTED(); 27 NOTIMPLEMENTED();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 141
141 gtk_box_pack_start(GTK_BOX(vbox_), toolbar, FALSE, FALSE, 0); 142 gtk_box_pack_start(GTK_BOX(vbox_), toolbar, FALSE, FALSE, 0);
142 143
143 gtk_container_add(GTK_CONTAINER(window_), vbox_); 144 gtk_container_add(GTK_CONTAINER(window_), vbox_);
144 gtk_widget_show_all(GTK_WIDGET(window_)); 145 gtk_widget_show_all(GTK_WIDGET(window_));
145 146
146 SizeTo(width, height); 147 SizeTo(width, height);
147 } 148 }
148 149
149 void Shell::PlatformSetContents() { 150 void Shell::PlatformSetContents() {
150 TabContentsViewGtk* content_view = 151 WebContentsView* content_view = web_contents_->GetView();
151 static_cast<TabContentsViewGtk*>(tab_contents_->GetView());
152 gtk_container_add(GTK_CONTAINER(vbox_), content_view->GetNativeView()); 152 gtk_container_add(GTK_CONTAINER(vbox_), content_view->GetNativeView());
153 153
154 // As an additional requirement on Linux, we must set the colors for the 154 // As an additional requirement on Linux, we must set the colors for the
155 // render widgets in webkit. 155 // render widgets in webkit.
156 content::RendererPreferences* prefs = 156 content::RendererPreferences* prefs =
157 tab_contents_->GetMutableRendererPrefs(); 157 web_contents_->GetMutableRendererPrefs();
158 prefs->focus_ring_color = SkColorSetARGB(255, 229, 151, 0); 158 prefs->focus_ring_color = SkColorSetARGB(255, 229, 151, 0);
159 prefs->thumb_active_color = SkColorSetRGB(244, 244, 244); 159 prefs->thumb_active_color = SkColorSetRGB(244, 244, 244);
160 prefs->thumb_inactive_color = SkColorSetRGB(234, 234, 234); 160 prefs->thumb_inactive_color = SkColorSetRGB(234, 234, 234);
161 prefs->track_color = SkColorSetRGB(211, 211, 211); 161 prefs->track_color = SkColorSetRGB(211, 211, 211);
162 162
163 prefs->active_selection_bg_color = SkColorSetRGB(30, 144, 255); 163 prefs->active_selection_bg_color = SkColorSetRGB(30, 144, 255);
164 prefs->active_selection_fg_color = SK_ColorWHITE; 164 prefs->active_selection_fg_color = SK_ColorWHITE;
165 prefs->inactive_selection_bg_color = SkColorSetRGB(200, 200, 200); 165 prefs->inactive_selection_bg_color = SkColorSetRGB(200, 200, 200);
166 prefs->inactive_selection_fg_color = SkColorSetRGB(50, 50, 50); 166 prefs->inactive_selection_fg_color = SkColorSetRGB(50, 50, 50);
167 } 167 }
168 168
169 void Shell::SizeTo(int width, int height) { 169 void Shell::SizeTo(int width, int height) {
170 content_width_ = width; 170 content_width_ = width;
171 content_height_ = height; 171 content_height_ = height;
172 if (tab_contents_.get()) { 172 if (web_contents_.get()) {
173 gtk_widget_set_size_request(tab_contents_->GetNativeView(), width, height); 173 gtk_widget_set_size_request(web_contents_->GetNativeView(), width, height);
174 } 174 }
175 } 175 }
176 176
177 void Shell::PlatformResizeSubViews() { 177 void Shell::PlatformResizeSubViews() {
178 SizeTo(content_width_, content_height_); 178 SizeTo(content_width_, content_height_);
179 } 179 }
180 180
181 void Shell::OnBackButtonClicked(GtkWidget* widget) { 181 void Shell::OnBackButtonClicked(GtkWidget* widget) {
182 GoBackOrForward(-1); 182 GoBackOrForward(-1);
183 } 183 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 gboolean Shell::OnHighlightURLView(GtkAccelGroup* accel_group, 225 gboolean Shell::OnHighlightURLView(GtkAccelGroup* accel_group,
226 GObject* acceleratable, 226 GObject* acceleratable,
227 guint keyval, 227 guint keyval,
228 GdkModifierType modifier) { 228 GdkModifierType modifier) {
229 gtk_widget_grab_focus(GTK_WIDGET(url_edit_view_)); 229 gtk_widget_grab_focus(GTK_WIDGET(url_edit_view_));
230 return TRUE; 230 return TRUE;
231 } 231 }
232 232
233 } // namespace content 233 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/shell_download_manager_delegate.cc ('k') | content/shell/shell_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698