OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "content/browser/tab_contents/navigation_controller.h" | 10 #include "content/browser/tab_contents/navigation_controller.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 shell->LoadURL(url); | 74 shell->LoadURL(url); |
75 return shell; | 75 return shell; |
76 } | 76 } |
77 | 77 |
78 void Shell::LoadURL(const GURL& url) { | 78 void Shell::LoadURL(const GURL& url) { |
79 tab_contents_->controller().LoadURL( | 79 tab_contents_->controller().LoadURL( |
80 url, | 80 url, |
81 GURL(), | 81 GURL(), |
82 PageTransition::TYPED, | 82 PageTransition::TYPED, |
83 std::string()); | 83 std::string()); |
| 84 tab_contents_->Focus(); |
84 } | 85 } |
85 | 86 |
86 void Shell::GoBackOrForward(int offset) { | 87 void Shell::GoBackOrForward(int offset) { |
87 tab_contents_->controller().GoToOffset(offset); | 88 tab_contents_->controller().GoToOffset(offset); |
| 89 tab_contents_->Focus(); |
88 } | 90 } |
89 | 91 |
90 void Shell::Reload() { | 92 void Shell::Reload() { |
91 tab_contents_->controller().Reload(false); | 93 tab_contents_->controller().Reload(false); |
| 94 tab_contents_->Focus(); |
92 } | 95 } |
93 | 96 |
94 void Shell::Stop() { | 97 void Shell::Stop() { |
95 tab_contents_->Stop(); | 98 tab_contents_->Stop(); |
| 99 tab_contents_->Focus(); |
96 } | 100 } |
97 | 101 |
98 void Shell::UpdateNavigationControls() { | 102 void Shell::UpdateNavigationControls() { |
99 int current_index = tab_contents_->controller().GetCurrentEntryIndex(); | 103 int current_index = tab_contents_->controller().GetCurrentEntryIndex(); |
100 int max_index = tab_contents_->controller().entry_count() - 1; | 104 int max_index = tab_contents_->controller().entry_count() - 1; |
101 | 105 |
102 PlatformEnableUIControl(BACK_BUTTON, current_index > 0); | 106 PlatformEnableUIControl(BACK_BUTTON, current_index > 0); |
103 PlatformEnableUIControl(FORWARD_BUTTON, current_index < max_index); | 107 PlatformEnableUIControl(FORWARD_BUTTON, current_index < max_index); |
104 PlatformEnableUIControl(STOP_BUTTON, tab_contents_->IsLoading()); | 108 PlatformEnableUIControl(STOP_BUTTON, tab_contents_->IsLoading()); |
105 } | 109 } |
(...skipping 11 matching lines...) Expand all Loading... |
117 void Shell::DidNavigateMainFramePostCommit(TabContents* tab) { | 121 void Shell::DidNavigateMainFramePostCommit(TabContents* tab) { |
118 PlatformSetAddressBarURL(tab->GetURL()); | 122 PlatformSetAddressBarURL(tab->GetURL()); |
119 } | 123 } |
120 | 124 |
121 void Shell::UpdatePreferredSize(TabContents* source, | 125 void Shell::UpdatePreferredSize(TabContents* source, |
122 const gfx::Size& pref_size) { | 126 const gfx::Size& pref_size) { |
123 PlatformSizeTo(pref_size.width(), pref_size.height()); | 127 PlatformSizeTo(pref_size.width(), pref_size.height()); |
124 } | 128 } |
125 | 129 |
126 } // namespace content | 130 } // namespace content |
OLD | NEW |