OLD | NEW |
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 "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "ui/aura/desktop/desktop_screen.h" | 8 #include "ui/aura/desktop/desktop_screen.h" |
9 #include "ui/aura/desktop/desktop_stacking_client.h" | 9 #include "ui/aura/desktop/desktop_stacking_client.h" |
10 #include "ui/aura/display_manager.h" | 10 #include "ui/aura/display_manager.h" |
11 #include "ui/aura/env.h" | 11 #include "ui/aura/env.h" |
12 #include "ui/aura/root_window.h" | 12 #include "ui/aura/root_window.h" |
13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
14 #include "ui/aura/single_display_manager.h" | 14 #include "ui/aura/single_display_manager.h" |
15 #include "ui/base/accessibility/accessibility_types.h" | 15 #include "ui/base/accessibility/accessibility_types.h" |
16 #include "ui/base/clipboard/clipboard.h" | 16 #include "ui/base/clipboard/clipboard.h" |
| 17 #include "ui/base/event.h" |
17 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
18 #include "ui/gfx/screen.h" | 19 #include "ui/gfx/screen.h" |
19 #include "ui/views/controls/button/text_button.h" | 20 #include "ui/views/controls/button/text_button.h" |
20 #include "ui/views/controls/textfield/textfield.h" | 21 #include "ui/views/controls/textfield/textfield.h" |
21 #include "ui/views/controls/textfield/textfield_controller.h" | 22 #include "ui/views/controls/textfield/textfield_controller.h" |
22 #include "ui/views/controls/webview/webview.h" | 23 #include "ui/views/controls/webview/webview.h" |
23 #include "ui/views/layout/fill_layout.h" | 24 #include "ui/views/layout/fill_layout.h" |
24 #include "ui/views/layout/grid_layout.h" | 25 #include "ui/views/layout/grid_layout.h" |
25 #include "ui/views/view.h" | 26 #include "ui/views/view.h" |
26 #include "ui/views/views_delegate.h" | 27 #include "ui/views/views_delegate.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 layout->AddView(contents_view_); | 244 layout->AddView(contents_view_); |
244 } | 245 } |
245 | 246 |
246 layout->AddPaddingRow(0, 5); | 247 layout->AddPaddingRow(0, 5); |
247 } | 248 } |
248 // Overriden from TextfieldController | 249 // Overriden from TextfieldController |
249 virtual void ContentsChanged(Textfield* sender, | 250 virtual void ContentsChanged(Textfield* sender, |
250 const string16& new_contents) OVERRIDE { | 251 const string16& new_contents) OVERRIDE { |
251 } | 252 } |
252 virtual bool HandleKeyEvent(Textfield* sender, | 253 virtual bool HandleKeyEvent(Textfield* sender, |
253 const KeyEvent& key_event) OVERRIDE { | 254 const ui::KeyEvent& key_event) OVERRIDE { |
254 if (sender == url_entry_ && key_event.key_code() == ui::VKEY_RETURN) { | 255 if (sender == url_entry_ && key_event.key_code() == ui::VKEY_RETURN) { |
255 std::string text = UTF16ToUTF8(url_entry_->text()); | 256 std::string text = UTF16ToUTF8(url_entry_->text()); |
256 GURL url(text); | 257 GURL url(text); |
257 if (!url.has_scheme()) { | 258 if (!url.has_scheme()) { |
258 url = GURL(std::string("http://") + std::string(text)); | 259 url = GURL(std::string("http://") + std::string(text)); |
259 url_entry_->SetText(ASCIIToUTF16(url.spec())); | 260 url_entry_->SetText(ASCIIToUTF16(url.spec())); |
260 } | 261 } |
261 shell_->LoadURL(url); | 262 shell_->LoadURL(url); |
262 return true; | 263 return true; |
263 } | 264 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 } | 405 } |
405 | 406 |
406 void Shell::PlatformSetTitle(const string16& title) { | 407 void Shell::PlatformSetTitle(const string16& title) { |
407 ShellWindowDelegateView* delegate_view = | 408 ShellWindowDelegateView* delegate_view = |
408 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); | 409 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); |
409 delegate_view->SetWindowTitle(title); | 410 delegate_view->SetWindowTitle(title); |
410 window_widget_->UpdateWindowTitle(); | 411 window_widget_->UpdateWindowTitle(); |
411 } | 412 } |
412 | 413 |
413 } // namespace content | 414 } // namespace content |
OLD | NEW |