summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-20 22:53:41 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-20 22:53:41 +0000
commit82114f59366794a020af471abc3c83ddfd34cde3 (patch)
treeb776d78e7676922894d286404b0260fbc9dd20a8 /content
parent85cd621132aca61852db935cf91baf7f53395084 (diff)
downloadchromium_src-82114f59366794a020af471abc3c83ddfd34cde3.zip
chromium_src-82114f59366794a020af471abc3c83ddfd34cde3.tar.gz
chromium_src-82114f59366794a020af471abc3c83ddfd34cde3.tar.bz2
Minor cleanup in content.
BUG=none TEST=none Review URL: http://codereview.chromium.org/9731009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127822 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/tab_contents/tab_contents.cc26
-rw-r--r--content/browser/tab_contents/tab_contents.h1
-rw-r--r--content/public/renderer/render_view.h14
-rw-r--r--content/renderer/render_view_impl.cc57
-rw-r--r--content/renderer/render_view_impl.h17
5 files changed, 45 insertions, 70 deletions
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index e924844..2709422 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -4,7 +4,6 @@
#include "content/browser/tab_contents/tab_contents.h"
-#include <cmath>
#include <utility>
#include "base/command_line.h"
@@ -62,7 +61,6 @@
#include "net/base/network_change_notifier.h"
#include "net/url_request/url_request_context_getter.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
-#include "ui/gfx/codec/png_codec.h"
#include "webkit/glue/web_intent_data.h"
#include "webkit/glue/webpreferences.h"
@@ -156,7 +154,7 @@ const int kQueryStateDelay = 5000;
const int kSyncWaitDelay = 40;
-static const char kDotGoogleDotCom[] = ".google.com";
+const char kDotGoogleDotCom[] = ".google.com";
#if defined(OS_WIN)
@@ -635,10 +633,8 @@ void TabContents::SetDelegate(content::WebContentsDelegate* delegate) {
}
content::RenderProcessHost* TabContents::GetRenderProcessHost() const {
- if (render_manager_.current_host())
- return render_manager_.current_host()->GetProcess();
- else
- return NULL;
+ RenderViewHostImpl* host = render_manager_.current_host();
+ return host ? host->GetProcess() : NULL;
}
RenderViewHost* TabContents::GetRenderViewHost() const {
@@ -1409,9 +1405,7 @@ bool TabContents::FocusLocationBarByDefault() {
if (web_ui)
return web_ui->ShouldFocusLocationBarByDefault();
NavigationEntry* entry = controller_.GetActiveEntry();
- if (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL))
- return true;
- return false;
+ return (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL));
}
void TabContents::SetFocusToLocationBar(bool select_all) {
@@ -1579,10 +1573,8 @@ void TabContents::OnDidRunInsecureContent(
LOG(INFO) << security_origin << " ran insecure content from "
<< target_url.possibly_invalid_spec();
content::RecordAction(UserMetricsAction("SSL.RanInsecureContent"));
- if (EndsWith(security_origin, kDotGoogleDotCom, false)) {
- content::RecordAction(
- UserMetricsAction("SSL.RanInsecureContentGoogle"));
- }
+ if (EndsWith(security_origin, kDotGoogleDotCom, false))
+ content::RecordAction(UserMetricsAction("SSL.RanInsecureContentGoogle"));
controller_.ssl_manager()->DidRunInsecureContent(security_origin);
displayed_insecure_content_ = true;
SSLManager::NotifySSLInternalStateChanged(&GetControllerImpl());
@@ -2179,10 +2171,8 @@ void TabContents::RequestMove(const gfx::Rect& new_bounds) {
void TabContents::DidStartLoading() {
SetIsLoading(true, NULL);
- if (delegate_ && content_restrictions_) {
- content_restrictions_ = 0;
- delegate_->ContentRestrictionsChanged(this);
- }
+ if (delegate_ && content_restrictions_)
+ OnUpdateContentRestrictions(0);
// Notify observers about navigation.
FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidStartLoading());
diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h
index 557f0ce..ff5171a 100644
--- a/content/browser/tab_contents/tab_contents.h
+++ b/content/browser/tab_contents/tab_contents.h
@@ -6,7 +6,6 @@
#define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_
#pragma once
-#include <deque>
#include <map>
#include <string>
diff --git a/content/public/renderer/render_view.h b/content/public/renderer/render_view.h
index 7ac69e1..966488f 100644
--- a/content/public/renderer/render_view.h
+++ b/content/public/renderer/render_view.h
@@ -57,13 +57,13 @@ class CONTENT_EXPORT RenderView : public IPC::Message::Sender {
// "regular" navigations that go into session history. In particular, client
// redirects, like the page cycler uses (document.location.href="foo") do not
// count as regular navigations and do not increment the page id.
- virtual int GetPageId() = 0;
+ virtual int GetPageId() const = 0;
// Returns the size of the view.
- virtual gfx::Size GetSize() = 0;
+ virtual gfx::Size GetSize() const = 0;
// Returns the window we are embedded within.
- virtual gfx::NativeViewId GetHostWindow() = 0;
+ virtual gfx::NativeViewId GetHostWindow() const = 0;
// Gets WebKit related preferences associated with this view.
virtual WebPreferences& GetWebkitPreferences() = 0;
@@ -79,7 +79,7 @@ class CONTENT_EXPORT RenderView : public IPC::Message::Sender {
// Returns true if the parameter node is a textfield, text area or a content
// editable div.
- virtual bool IsEditableNode(const WebKit::WebNode& node) = 0;
+ virtual bool IsEditableNode(const WebKit::WebNode& node) const = 0;
// Create a new NPAPI/Pepper plugin depending on |info|. Returns NULL if no
// plugin was found.
@@ -100,15 +100,15 @@ class CONTENT_EXPORT RenderView : public IPC::Message::Sender {
// Bitwise-ORed set of extra bindings that have been enabled. See
// BindingsPolicy for details.
- virtual int GetEnabledBindings() = 0;
+ virtual int GetEnabledBindings() const = 0;
// Whether content state (such as form state, scroll position and page
// contents) should be sent to the browser immediately. This is normally
// false, but set to true by some tests.
- virtual bool GetContentStateImmediately() = 0;
+ virtual bool GetContentStateImmediately() const = 0;
// Filtered time per frame based on UpdateRect messages.
- virtual float GetFilteredTimePerFrame() = 0;
+ virtual float GetFilteredTimePerFrame() const = 0;
// Shows a context menu with commands relevant to a specific element on
// the given frame. Additional context data is supplied.
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 23e91f6..c14e518 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -378,7 +378,7 @@ namespace {
class WebWidgetLockTarget : public MouseLockDispatcher::LockTarget {
public:
- WebWidgetLockTarget (WebKit::WebWidget* webwidget)
+ explicit WebWidgetLockTarget(WebKit::WebWidget* webwidget)
: webwidget_(webwidget) {}
virtual void OnLockMouseACK(bool succeeded) OVERRIDE {
@@ -1840,16 +1840,6 @@ void RenderViewImpl::showContextMenu(
Send(new ViewHostMsg_ContextMenu(routing_id_, params));
}
-void RenderViewImpl::enterFullscreen() {
- // TODO(darin): Remove once WebKit roll is complete.
- enterFullScreen();
-}
-
-void RenderViewImpl::exitFullscreen() {
- // TODO(darin): Remove once WebKit roll is complete.
- exitFullScreen();
-}
-
void RenderViewImpl::setStatusText(const WebString& text) {
}
@@ -2546,7 +2536,7 @@ void RenderViewImpl::didCreateDataSource(WebFrame* frame, WebDataSource* ds) {
if (!referrer.is_empty() &&
DocumentState::FromDataSource(
old_frame->dataSource())->was_prefetcher()) {
- for (;old_frame;old_frame = old_frame->traverseNext(false)) {
+ for (; old_frame; old_frame = old_frame->traverseNext(false)) {
WebDataSource* old_frame_ds = old_frame->dataSource();
if (old_frame_ds && referrer == GURL(old_frame_ds->request().url())) {
document_state->set_was_referred_by_prefetcher(true);
@@ -3427,7 +3417,7 @@ bool RenderViewImpl::Send(IPC::Message* message) {
return RenderWidget::Send(message);
}
-int RenderViewImpl::GetRoutingID() const {
+int RenderViewImpl::GetRoutingID() const {
return routing_id_;
}
@@ -3435,27 +3425,27 @@ bool RenderViewImpl::IsGuest() const {
return guest_;
}
-int RenderViewImpl::GetPageId() {
+int RenderViewImpl::GetPageId() const {
return page_id_;
}
-gfx::Size RenderViewImpl::GetSize() {
+gfx::Size RenderViewImpl::GetSize() const {
return size();
}
-gfx::NativeViewId RenderViewImpl::GetHostWindow() {
+gfx::NativeViewId RenderViewImpl::GetHostWindow() const {
return host_window();
}
-WebPreferences& RenderViewImpl::GetWebkitPreferences() {
+WebPreferences& RenderViewImpl::GetWebkitPreferences() {
return webkit_preferences_;
}
-WebKit::WebView* RenderViewImpl::GetWebView() {
+WebKit::WebView* RenderViewImpl::GetWebView() {
return webview();
}
-WebKit::WebNode RenderViewImpl::GetFocusedNode() const {
+WebKit::WebNode RenderViewImpl::GetFocusedNode() const {
if (!webview())
return WebNode();
WebFrame* focused_frame = webview()->focusedFrame();
@@ -3468,11 +3458,11 @@ WebKit::WebNode RenderViewImpl::GetFocusedNode() const {
return WebNode();
}
-WebKit::WebNode RenderViewImpl::GetContextMenuNode() const {
+WebKit::WebNode RenderViewImpl::GetContextMenuNode() const {
return context_menu_node_;
}
-bool RenderViewImpl::IsEditableNode(const WebKit::WebNode& node) {
+bool RenderViewImpl::IsEditableNode(const WebKit::WebNode& node) const {
bool is_editable_node = false;
if (!node.isNull()) {
if (node.isContentEditable()) {
@@ -3488,7 +3478,7 @@ bool RenderViewImpl::IsEditableNode(const WebKit::WebNode& node) {
WebKit::WebPlugin* RenderViewImpl::CreatePlugin(
WebKit::WebFrame* frame,
const webkit::WebPluginInfo& info,
- const WebKit::WebPluginParams& params) {
+ const WebKit::WebPluginParams& params) {
bool pepper_plugin_was_registered = false;
scoped_refptr<webkit::ppapi::PluginModule> pepper_module(
pepper_delegate_.CreatePepperPluginModule(info,
@@ -3539,24 +3529,24 @@ bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const {
disable_scrollbars_size_limit_.height() <= height));
}
-int RenderViewImpl::GetEnabledBindings() {
+int RenderViewImpl::GetEnabledBindings() const {
return enabled_bindings_;
}
-bool RenderViewImpl::GetContentStateImmediately() {
+bool RenderViewImpl::GetContentStateImmediately() const {
return send_content_state_immediately_;
}
-float RenderViewImpl::GetFilteredTimePerFrame() {
+float RenderViewImpl::GetFilteredTimePerFrame() const {
return filtered_time_per_frame();
}
void RenderViewImpl::ShowContextMenu(WebKit::WebFrame* frame,
- const WebKit::WebContextMenuData& data) {
+ const WebKit::WebContextMenuData& data) {
showContextMenu(frame, data);
}
-WebKit::WebPageVisibilityState RenderViewImpl::GetVisibilityState() const {
+WebKit::WebPageVisibilityState RenderViewImpl::GetVisibilityState() const {
return visibilityState();
}
@@ -3672,7 +3662,7 @@ void RenderViewImpl::SyncSelectionIfRequired() {
if (pepper_delegate_.IsPluginFocused()) {
pepper_delegate_.GetSurroundingText(&text, &range);
- offset = 0; // Pepper API does not support offset reporting.
+ offset = 0; // Pepper API does not support offset reporting.
// TODO(kinaba): cut as needed.
} else {
size_t location, length;
@@ -3742,7 +3732,7 @@ GURL RenderViewImpl::GetAlternateErrorPageURL(const GURL& failed_url,
std::string spec_to_send = url_to_send.spec();
// Notify link doctor of the url truncation by sending of "?" at the end.
if (failed_url.has_query())
- spec_to_send.append("?");
+ spec_to_send.append("?");
// Construct the query params to send to link doctor.
std::string params(alternate_error_page_url_.query());
@@ -4444,8 +4434,9 @@ bool RenderViewImpl::MaybeLoadAlternateErrorPage(WebFrame* frame,
ec != net::ERR_CONNECTION_FAILED &&
ec != net::ERR_CONNECTION_REFUSED &&
ec != net::ERR_ADDRESS_UNREACHABLE &&
- ec != net::ERR_CONNECTION_TIMED_OUT)
+ ec != net::ERR_CONNECTION_TIMED_OUT) {
return false;
+ }
const GURL& error_page_url = GetAlternateErrorPageURL(error.unreachableURL,
ec == net::ERR_NAME_NOT_RESOLVED ? DNS_ERROR : CONNECTION_ERROR);
@@ -4912,9 +4903,7 @@ void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) {
#if defined(OS_MACOSX)
void RenderViewImpl::PluginFocusChanged(bool focused, int plugin_id) {
- IPC::Message* msg = new ViewHostMsg_PluginFocusChanged(routing_id(),
- focused, plugin_id);
- Send(msg);
+ Send(new ViewHostMsg_PluginFocusChanged(routing_id(), focused, plugin_id));
}
void RenderViewImpl::StartPluginIme() {
@@ -4983,7 +4972,7 @@ void RenderViewImpl::AcceleratedSurfaceBuffersSwapped(
Send(new ViewHostMsg_AcceleratedSurfaceBuffersSwapped(
routing_id(), window, surface_handle));
}
-#endif
+#endif // defined(OS_MACOSX)
bool RenderViewImpl::ScheduleFileChooser(
const content::FileChooserParams& params,
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index 93d476a..e009fa2 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -8,7 +8,6 @@
#include <deque>
#include <map>
-#include <queue>
#include <set>
#include <string>
#include <vector>
@@ -391,8 +390,6 @@ class RenderViewImpl : public RenderWidget,
const WebKit::WebString& message);
virtual void showContextMenu(WebKit::WebFrame* frame,
const WebKit::WebContextMenuData& data);
- virtual void enterFullscreen();
- virtual void exitFullscreen();
virtual void setStatusText(const WebKit::WebString& text);
virtual void setMouseOverURL(const WebKit::WebURL& url);
virtual void setKeyboardFocusURL(const WebKit::WebURL& url);
@@ -591,14 +588,14 @@ class RenderViewImpl : public RenderWidget,
virtual bool Send(IPC::Message* message) OVERRIDE;
virtual int GetRoutingID() const OVERRIDE;
bool IsGuest() const;
- virtual int GetPageId() OVERRIDE;
- virtual gfx::Size GetSize() OVERRIDE;
- virtual gfx::NativeViewId GetHostWindow() OVERRIDE;
+ virtual int GetPageId() const OVERRIDE;
+ virtual gfx::Size GetSize() const OVERRIDE;
+ virtual gfx::NativeViewId GetHostWindow() const OVERRIDE;
virtual WebPreferences& GetWebkitPreferences() OVERRIDE;
virtual WebKit::WebView* GetWebView() OVERRIDE;
virtual WebKit::WebNode GetFocusedNode() const OVERRIDE;
virtual WebKit::WebNode GetContextMenuNode() const OVERRIDE;
- virtual bool IsEditableNode(const WebKit::WebNode& node) OVERRIDE;
+ virtual bool IsEditableNode(const WebKit::WebNode& node) const OVERRIDE;
virtual WebKit::WebPlugin* CreatePlugin(
WebKit::WebFrame* frame,
const webkit::WebPluginInfo& info,
@@ -608,9 +605,9 @@ class RenderViewImpl : public RenderWidget,
int id,
bool notify_result) OVERRIDE;
virtual bool ShouldDisplayScrollbars(int width, int height) const OVERRIDE;
- virtual int GetEnabledBindings() OVERRIDE;
- virtual bool GetContentStateImmediately() OVERRIDE;
- virtual float GetFilteredTimePerFrame() OVERRIDE;
+ virtual int GetEnabledBindings() const OVERRIDE;
+ virtual bool GetContentStateImmediately() const OVERRIDE;
+ virtual float GetFilteredTimePerFrame() const OVERRIDE;
virtual void ShowContextMenu(WebKit::WebFrame* frame,
const WebKit::WebContextMenuData& data) OVERRIDE;
virtual WebKit::WebPageVisibilityState GetVisibilityState() const OVERRIDE;