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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 14080004: Remove some chrome-specific methods from content::WebUI. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 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
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/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after
1891 } 1891 }
1892 1892
1893 gfx::Size WebContentsImpl::GetPreferredSize() const { 1893 gfx::Size WebContentsImpl::GetPreferredSize() const {
1894 return preferred_size_; 1894 return preferred_size_;
1895 } 1895 }
1896 1896
1897 int WebContentsImpl::GetContentRestrictions() const { 1897 int WebContentsImpl::GetContentRestrictions() const {
1898 return content_restrictions_; 1898 return content_restrictions_;
1899 } 1899 }
1900 1900
1901 WebUI* WebContentsImpl::GetWebUIForCurrentState() {
1902 // When there is a pending navigation entry, we want to use the pending WebUI
1903 // that goes along with it to control the basic flags. For example, we want to
1904 // show the pending URL in the URL bar, so we want the display_url flag to
1905 // be from the pending entry.
1906 //
1907 // The confusion comes because there are multiple possibilities for the
1908 // initial load in a tab as a side effect of the way the RenderViewHostManager
1909 // works.
1910 //
1911 // - For the very first tab the load looks "normal". The new tab Web UI is
1912 // the pending one, and we want it to apply here.
1913 //
1914 // - For subsequent new tabs, they'll get a new SiteInstance which will then
1915 // get switched to the one previously associated with the new tab pages.
1916 // This switching will cause the manager to commit the RVH/WebUI. So we'll
1917 // have a committed Web UI in this case.
1918 //
1919 // This condition handles all of these cases:
1920 //
1921 // - First load in first tab: no committed nav entry + pending nav entry +
1922 // pending dom ui:
1923 // -> Use pending Web UI if any.
1924 //
1925 // - First load in second tab: no committed nav entry + pending nav entry +
1926 // no pending Web UI:
1927 // -> Use the committed Web UI if any.
1928 //
1929 // - Second navigation in any tab: committed nav entry + pending nav entry:
1930 // -> Use pending Web UI if any.
1931 //
1932 // - Normal state with no load: committed nav entry + no pending nav entry:
1933 // -> Use committed Web UI.
1934 if (controller_.GetPendingEntry() &&
1935 (controller_.GetLastCommittedEntry() ||
1936 render_manager_.pending_web_ui()))
1937 return render_manager_.pending_web_ui();
1938 return render_manager_.web_ui();
1939 }
1940
Avi (use Gerrit) 2013/04/10 23:12:15 This deletion doesn't seem relevant to this CL.
jam 2013/04/10 23:45:35 this method isn't used anymore (see the diff below
1941 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { 1901 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) {
1942 return GetRenderViewHost() ? 1902 return GetRenderViewHost() ?
1943 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; 1903 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false;
1944 } 1904 }
1945 1905
1946 bool WebContentsImpl::HasOpener() const { 1906 bool WebContentsImpl::HasOpener() const {
1947 return opener_ != NULL; 1907 return opener_ != NULL;
1948 } 1908 }
1949 1909
1950 void WebContentsImpl::DidChooseColorInColorChooser(int color_chooser_id, 1910 void WebContentsImpl::DidChooseColorInColorChooser(int color_chooser_id,
(...skipping 13 matching lines...) Expand all
1964 bool is_favicon, 1924 bool is_favicon,
1965 int image_size, 1925 int image_size,
1966 const ImageDownloadCallback& callback) { 1926 const ImageDownloadCallback& callback) {
1967 RenderViewHost* host = GetRenderViewHost(); 1927 RenderViewHost* host = GetRenderViewHost();
1968 int id = StartDownload(host, url, is_favicon, image_size); 1928 int id = StartDownload(host, url, is_favicon, image_size);
1969 image_download_map_[id] = callback; 1929 image_download_map_[id] = callback;
1970 return id; 1930 return id;
1971 } 1931 }
1972 1932
1973 bool WebContentsImpl::FocusLocationBarByDefault() { 1933 bool WebContentsImpl::FocusLocationBarByDefault() {
1974 WebUI* web_ui = GetWebUIForCurrentState();
1975 if (web_ui)
1976 return web_ui->ShouldFocusLocationBarByDefault();
1977 NavigationEntry* entry = controller_.GetActiveEntry(); 1934 NavigationEntry* entry = controller_.GetActiveEntry();
1978 if (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL)) 1935 if (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL))
1979 return true; 1936 return true;
1980 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); 1937 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this);
1981 } 1938 }
1982 1939
1983 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { 1940 void WebContentsImpl::SetFocusToLocationBar(bool select_all) {
1984 if (delegate_) 1941 if (delegate_)
1985 delegate_->SetFocusToLocationBar(select_all); 1942 delegate_->SetFocusToLocationBar(select_all);
1986 } 1943 }
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after
3438 } 3395 }
3439 3396
3440 BrowserPluginGuestManager* 3397 BrowserPluginGuestManager*
3441 WebContentsImpl::GetBrowserPluginGuestManager() const { 3398 WebContentsImpl::GetBrowserPluginGuestManager() const {
3442 return static_cast<BrowserPluginGuestManager*>( 3399 return static_cast<BrowserPluginGuestManager*>(
3443 GetBrowserContext()->GetUserData( 3400 GetBrowserContext()->GetUserData(
3444 browser_plugin::kBrowserPluginGuestManagerKeyName)); 3401 browser_plugin::kBrowserPluginGuestManagerKeyName));
3445 } 3402 }
3446 3403
3447 } // namespace content 3404 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698