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

Side by Side Diff: chrome/browser/ui/webui/ntp/new_tab_ui.cc

Issue 9600036: Move Render(View|Widget)Host and associated classes to content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments. Created 8 years, 9 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 7 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "grit/browser_resources.h" 53 #include "grit/browser_resources.h"
54 #include "grit/generated_resources.h" 54 #include "grit/generated_resources.h"
55 #include "grit/theme_resources.h" 55 #include "grit/theme_resources.h"
56 #include "ui/base/l10n/l10n_util.h" 56 #include "ui/base/l10n/l10n_util.h"
57 57
58 #if !defined(OS_ANDROID) 58 #if !defined(OS_ANDROID)
59 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h" 59 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h"
60 #endif 60 #endif
61 61
62 using content::BrowserThread; 62 using content::BrowserThread;
63 using content::RenderViewHost;
63 using content::UserMetricsAction; 64 using content::UserMetricsAction;
64 using content::WebContents; 65 using content::WebContents;
65 using content::WebUIController; 66 using content::WebUIController;
66 67
67 namespace { 68 namespace {
68 69
69 // The amount of time there must be no painting for us to consider painting 70 // The amount of time there must be no painting for us to consider painting
70 // finished. Observed times are in the ~1200ms range on Windows. 71 // finished. Observed times are in the ~1200ms range on Windows.
71 const int kTimeoutMs = 2000; 72 const int kTimeoutMs = 2000;
72 73
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // Wait some more. 190 // Wait some more.
190 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kTimeoutMs), this, 191 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kTimeoutMs), this,
191 &NewTabUI::PaintTimeout); 192 &NewTabUI::PaintTimeout);
192 } 193 }
193 } 194 }
194 195
195 void NewTabUI::StartTimingPaint(RenderViewHost* render_view_host) { 196 void NewTabUI::StartTimingPaint(RenderViewHost* render_view_host) {
196 start_ = base::TimeTicks::Now(); 197 start_ = base::TimeTicks::Now();
197 last_paint_ = start_; 198 last_paint_ = start_;
198 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, 199 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT,
199 content::Source<RenderWidgetHost>(render_view_host)); 200 content::Source<content::RenderWidgetHost>(render_view_host));
200 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kTimeoutMs), this, 201 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kTimeoutMs), this,
201 &NewTabUI::PaintTimeout); 202 &NewTabUI::PaintTimeout);
202 203
203 } 204 }
204 205
205 bool NewTabUI::CanShowBookmarkBar() const { 206 bool NewTabUI::CanShowBookmarkBar() const {
206 PrefService* prefs = GetProfile()->GetPrefs(); 207 PrefService* prefs = GetProfile()->GetPrefs();
207 bool disabled_by_policy = 208 bool disabled_by_policy =
208 prefs->IsManagedPreference(prefs::kShowBookmarkBar) && 209 prefs->IsManagedPreference(prefs::kShowBookmarkBar) &&
209 !prefs->GetBoolean(prefs::kShowBookmarkBar); 210 !prefs->GetBoolean(prefs::kShowBookmarkBar);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 } 407 }
407 408
408 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, 409 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource,
409 const char* mime_type, 410 const char* mime_type,
410 int resource_id) { 411 int resource_id) {
411 DCHECK(resource); 412 DCHECK(resource);
412 DCHECK(mime_type); 413 DCHECK(mime_type);
413 resource_map_[std::string(resource)] = 414 resource_map_[std::string(resource)] =
414 std::make_pair(std::string(mime_type), resource_id); 415 std::make_pair(std::string(mime_type), resource_id);
415 } 416 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_ui.h ('k') | chrome/browser/ui/webui/options/extension_settings_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698