Get rid of the RenderViewType concept in content, since it was only used by Chrome. Store the enum value in the WebContents' property bag.

BUG=98716
Review URL: https://chromiumcodereview.appspot.com/10409088

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138434 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc
index 2f08bbf3..3f2dedc 100644
--- a/chrome/browser/memory_details.cc
+++ b/chrome/browser/memory_details.cc
@@ -14,7 +14,7 @@
 #include "chrome/browser/extensions/extension_process_manager.h"
 #include "chrome/browser/extensions/extension_service.h"
 #include "chrome/browser/profiles/profile.h"
-#include "chrome/common/chrome_view_type.h"
+#include "chrome/browser/view_type_utils.h"
 #include "chrome/common/extensions/extension.h"
 #include "chrome/common/url_constants.h"
 #include "content/public/browser/browser_child_process_host_iterator.h"
@@ -24,7 +24,6 @@
 #include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/render_process_host.h"
 #include "content/public/browser/render_view_host.h"
-#include "content/public/browser/render_view_host_delegate.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/bindings_policy.h"
 #include "content/public/common/process_type.h"
@@ -242,12 +241,13 @@
         if (!widget || !widget->IsRenderView())
           continue;
 
-        const RenderViewHost* host =
+        RenderViewHost* host =
             RenderViewHost::From(const_cast<RenderWidgetHost*>(widget));
-        content::RenderViewHostDelegate* host_delegate = host->GetDelegate();
-        DCHECK(host_delegate);
-        GURL url = host_delegate->GetURL();
-        content::ViewType type = host_delegate->GetRenderViewType();
+        WebContents* contents = WebContents::FromRenderViewHost(host);
+        GURL url;
+        if (contents)
+          url = contents->GetURL();
+        chrome::ViewType type = chrome::GetViewType(contents);
         if (host->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI) {
           process.renderer_type = ProcessMemoryInformation::RENDERER_CHROME;
         } else if (extension_process_map->Contains(
@@ -268,41 +268,37 @@
             }
           }
         }
-        WebContents* contents = host_delegate->GetAsWebContents();
-        if (!contents) {
-          if (extension_process_map->Contains(host->GetProcess()->GetID())) {
-            const Extension* extension =
-                extension_service->extensions()->GetByID(url.host());
-            if (extension) {
-              string16 title = UTF8ToUTF16(extension->name());
-              process.titles.push_back(title);
-            }
-          } else if (process.renderer_type ==
-                     ProcessMemoryInformation::RENDERER_UNKNOWN) {
-            process.titles.push_back(UTF8ToUTF16(url.spec()));
-            switch (type) {
-              case chrome::VIEW_TYPE_BACKGROUND_CONTENTS:
-                process.renderer_type =
-                    ProcessMemoryInformation::RENDERER_BACKGROUND_APP;
-                break;
-              case content::VIEW_TYPE_INTERSTITIAL_PAGE:
-                process.renderer_type =
-                    ProcessMemoryInformation::RENDERER_INTERSTITIAL;
-                break;
-              case chrome::VIEW_TYPE_NOTIFICATION:
-                process.renderer_type =
-                    ProcessMemoryInformation::RENDERER_NOTIFICATION;
-                break;
-              default:
-                process.renderer_type =
-                    ProcessMemoryInformation::RENDERER_UNKNOWN;
-                break;
-            }
+        if (extension_process_map->Contains(host->GetProcess()->GetID())) {
+          const Extension* extension =
+              extension_service->extensions()->GetByID(url.host());
+          if (extension) {
+            string16 title = UTF8ToUTF16(extension->name());
+            process.titles.push_back(title);
           }
           continue;
         }
 
-        // Since We have a WebContents and and the renderer type hasn't been
+        if (!contents) {
+          process.renderer_type =
+                ProcessMemoryInformation::RENDERER_INTERSTITIAL;
+          continue;
+        }
+
+        if (type == chrome::VIEW_TYPE_BACKGROUND_CONTENTS) {
+          process.titles.push_back(UTF8ToUTF16(url.spec()));
+          process.renderer_type =
+                    ProcessMemoryInformation::RENDERER_BACKGROUND_APP;
+          continue;
+        }
+
+        if (type == chrome::VIEW_TYPE_NOTIFICATION) {
+          process.titles.push_back(UTF8ToUTF16(url.spec()));
+          process.renderer_type =
+                    ProcessMemoryInformation::RENDERER_NOTIFICATION;
+          continue;
+        }
+
+        // Since we have a WebContents and and the renderer type hasn't been
         // set yet, it must be a normal tabbed renderer.
         if (process.renderer_type == ProcessMemoryInformation::RENDERER_UNKNOWN)
           process.renderer_type = ProcessMemoryInformation::RENDERER_NORMAL;