| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 #include "content/public/browser/web_contents_view.h" |
| 10 #include "ui/aura/env.h" | 11 #include "ui/aura/env.h" |
| 11 #include "ui/aura/root_window.h" | 12 #include "ui/aura/root_window.h" |
| 12 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 13 #include "ui/base/accessibility/accessibility_types.h" | 14 #include "ui/base/accessibility/accessibility_types.h" |
| 14 #include "ui/base/clipboard/clipboard.h" | 15 #include "ui/base/clipboard/clipboard.h" |
| 15 #include "ui/base/events/event.h" | 16 #include "ui/base/events/event.h" |
| 16 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 17 #include "ui/gfx/screen.h" | 18 #include "ui/gfx/screen.h" |
| 18 #include "ui/views/controls/button/text_button.h" | 19 #include "ui/views/controls/button/text_button.h" |
| 19 #include "ui/views/controls/textfield/textfield.h" | 20 #include "ui/views/controls/textfield/textfield.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 virtual ~ShellWindowDelegateView() {} | 81 virtual ~ShellWindowDelegateView() {} |
| 81 | 82 |
| 82 // Update the state of UI controls | 83 // Update the state of UI controls |
| 83 void SetAddressBarURL(const GURL& url) { | 84 void SetAddressBarURL(const GURL& url) { |
| 84 url_entry_->SetText(ASCIIToUTF16(url.spec())); | 85 url_entry_->SetText(ASCIIToUTF16(url.spec())); |
| 85 } | 86 } |
| 86 void SetWebContents(content::WebContents* web_contents) { | 87 void SetWebContents(content::WebContents* web_contents) { |
| 87 contents_view_->SetLayoutManager(new FillLayout()); | 88 contents_view_->SetLayoutManager(new FillLayout()); |
| 88 web_view_ = new WebView(web_contents->GetBrowserContext()); | 89 web_view_ = new WebView(web_contents->GetBrowserContext()); |
| 89 web_view_->SetWebContents(web_contents); | 90 web_view_->SetWebContents(web_contents); |
| 90 web_contents->Focus(); | 91 web_contents->GetView()->Focus(); |
| 91 contents_view_->AddChildView(web_view_); | 92 contents_view_->AddChildView(web_view_); |
| 92 Layout(); | 93 Layout(); |
| 93 } | 94 } |
| 94 void SetWindowTitle(const string16& title) { title_ = title; } | 95 void SetWindowTitle(const string16& title) { title_ = title; } |
| 95 void EnableUIControl(UIControl control, bool is_enabled) { | 96 void EnableUIControl(UIControl control, bool is_enabled) { |
| 96 if (control == BACK_BUTTON) { | 97 if (control == BACK_BUTTON) { |
| 97 back_button_->SetState(is_enabled ? CustomButton::STATE_NORMAL | 98 back_button_->SetState(is_enabled ? CustomButton::STATE_NORMAL |
| 98 : CustomButton::STATE_DISABLED); | 99 : CustomButton::STATE_DISABLED); |
| 99 } else if (control == FORWARD_BUTTON) { | 100 } else if (control == FORWARD_BUTTON) { |
| 100 forward_button_->SetState(is_enabled ? CustomButton::STATE_NORMAL | 101 forward_button_->SetState(is_enabled ? CustomButton::STATE_NORMAL |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 } | 366 } |
| 366 | 367 |
| 367 void Shell::PlatformSetTitle(const string16& title) { | 368 void Shell::PlatformSetTitle(const string16& title) { |
| 368 ShellWindowDelegateView* delegate_view = | 369 ShellWindowDelegateView* delegate_view = |
| 369 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); | 370 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); |
| 370 delegate_view->SetWindowTitle(title); | 371 delegate_view->SetWindowTitle(title); |
| 371 window_widget_->UpdateWindowTitle(); | 372 window_widget_->UpdateWindowTitle(); |
| 372 } | 373 } |
| 373 | 374 |
| 374 } // namespace content | 375 } // namespace content |
| OLD | NEW |